2020-03-02 23:02:25 +03:00
|
|
|
use crate::assets::Assets;
|
2020-06-18 22:44:47 +03:00
|
|
|
use crate::{hotkey, Key, ScreenDims, ScreenPt, ScreenRectangle, UserInput};
|
2019-10-27 02:16:32 +03:00
|
|
|
use abstutil::Timer;
|
2020-02-11 03:18:31 +03:00
|
|
|
use geom::{Bounds, Pt2D};
|
2020-05-20 01:06:32 +03:00
|
|
|
use serde::{Deserialize, Serialize};
|
2018-12-17 01:56:28 +03:00
|
|
|
use std::cell::RefCell;
|
2018-03-13 18:04:21 +03:00
|
|
|
|
2020-03-03 21:19:37 +03:00
|
|
|
// Click and release counts as a normal click, not a drag, if the distance between click and
|
|
|
|
// release is less than this.
|
|
|
|
const DRAG_THRESHOLD: f64 = 5.0;
|
|
|
|
|
2020-03-08 03:13:30 +03:00
|
|
|
const PAN_SPEED: f64 = 15.0;
|
|
|
|
|
2020-05-23 21:23:38 +03:00
|
|
|
const PANNING_THRESHOLD: f64 = 25.0;
|
2020-05-23 20:42:59 +03:00
|
|
|
|
2018-03-13 18:04:21 +03:00
|
|
|
pub struct Canvas {
|
2018-09-19 00:41:30 +03:00
|
|
|
// All of these f64's are in screen-space, so do NOT use Pt2D.
|
|
|
|
// Public for saving/loading... should probably do better
|
2018-03-13 18:04:21 +03:00
|
|
|
pub cam_x: f64,
|
|
|
|
pub cam_y: f64,
|
|
|
|
pub cam_zoom: f64,
|
|
|
|
|
2018-12-23 03:58:36 +03:00
|
|
|
// TODO We probably shouldn't even track screen-space cursor when we don't have the cursor.
|
2019-02-01 10:32:38 +03:00
|
|
|
pub(crate) cursor_x: f64,
|
|
|
|
pub(crate) cursor_y: f64,
|
2019-10-12 20:24:07 +03:00
|
|
|
pub(crate) window_has_cursor: bool,
|
2018-03-13 18:04:21 +03:00
|
|
|
|
2020-03-03 21:19:37 +03:00
|
|
|
// Only for drags starting on the map. Only used to pan the map. (Last event, original)
|
|
|
|
pub(crate) drag_canvas_from: Option<(ScreenPt, ScreenPt)>,
|
2019-12-12 00:52:01 +03:00
|
|
|
pub(crate) drag_just_ended: bool,
|
2018-07-06 20:02:01 +03:00
|
|
|
|
2018-12-21 20:49:46 +03:00
|
|
|
pub window_width: f64,
|
|
|
|
pub window_height: f64,
|
2020-02-18 18:30:32 +03:00
|
|
|
|
|
|
|
// TODO Proper API for setting these
|
2020-01-14 01:39:02 +03:00
|
|
|
pub map_dims: (f64, f64),
|
2020-02-18 18:30:32 +03:00
|
|
|
pub invert_scroll: bool,
|
2020-03-08 03:13:30 +03:00
|
|
|
pub touchpad_to_move: bool,
|
2020-05-23 20:42:59 +03:00
|
|
|
pub edge_auto_panning: bool,
|
2020-06-18 22:44:47 +03:00
|
|
|
pub keys_to_pan: bool,
|
2018-12-17 01:56:28 +03:00
|
|
|
|
2018-12-23 05:02:03 +03:00
|
|
|
// TODO Bit weird and hacky to mutate inside of draw() calls.
|
2019-02-01 10:32:38 +03:00
|
|
|
pub(crate) covered_areas: RefCell<Vec<ScreenRectangle>>,
|
2019-05-04 01:32:14 +03:00
|
|
|
|
|
|
|
// Kind of just ezgui state awkwardly stuck here...
|
2019-05-29 23:28:51 +03:00
|
|
|
pub(crate) lctrl_held: bool,
|
2020-03-09 23:23:03 +03:00
|
|
|
pub(crate) lshift_held: bool,
|
2018-03-13 18:04:21 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Canvas {
|
2020-02-09 21:56:50 +03:00
|
|
|
pub(crate) fn new(initial_width: f64, initial_height: f64) -> Canvas {
|
2019-11-29 09:41:08 +03:00
|
|
|
Canvas {
|
2018-03-13 18:04:21 +03:00
|
|
|
cam_x: 0.0,
|
|
|
|
cam_y: 0.0,
|
|
|
|
cam_zoom: 1.0,
|
|
|
|
|
|
|
|
cursor_x: 0.0,
|
|
|
|
cursor_y: 0.0,
|
2018-12-23 03:58:36 +03:00
|
|
|
window_has_cursor: true,
|
2018-03-13 18:04:21 +03:00
|
|
|
|
2019-12-12 00:52:01 +03:00
|
|
|
drag_canvas_from: None,
|
|
|
|
drag_just_ended: false,
|
|
|
|
|
2019-01-25 20:48:33 +03:00
|
|
|
window_width: initial_width,
|
|
|
|
window_height: initial_height,
|
2020-02-18 18:30:32 +03:00
|
|
|
|
2020-01-14 01:39:02 +03:00
|
|
|
map_dims: (0.0, 0.0),
|
2020-02-18 18:30:32 +03:00
|
|
|
invert_scroll: false,
|
2020-03-08 03:13:30 +03:00
|
|
|
touchpad_to_move: false,
|
2020-05-23 20:42:59 +03:00
|
|
|
edge_auto_panning: false,
|
2020-06-18 22:44:47 +03:00
|
|
|
keys_to_pan: false,
|
2018-12-17 01:56:28 +03:00
|
|
|
|
2018-12-23 05:02:03 +03:00
|
|
|
covered_areas: RefCell::new(Vec::new()),
|
2019-05-04 01:32:14 +03:00
|
|
|
|
2019-05-29 23:28:51 +03:00
|
|
|
lctrl_held: false,
|
2020-03-09 23:23:03 +03:00
|
|
|
lshift_held: false,
|
2019-11-29 09:41:08 +03:00
|
|
|
}
|
2018-03-13 18:04:21 +03:00
|
|
|
}
|
|
|
|
|
2020-01-14 01:39:02 +03:00
|
|
|
pub fn min_zoom(&self) -> f64 {
|
|
|
|
let percent_window = 0.8;
|
|
|
|
(percent_window * self.window_width / self.map_dims.0)
|
|
|
|
.min(percent_window * self.window_height / self.map_dims.1)
|
|
|
|
}
|
|
|
|
|
2020-01-07 20:43:34 +03:00
|
|
|
pub(crate) fn handle_event(&mut self, input: &mut UserInput) {
|
2019-08-06 22:05:09 +03:00
|
|
|
// Can't start dragging or zooming on top of covered area
|
2019-12-12 00:52:01 +03:00
|
|
|
if self.get_cursor_in_map_space().is_some() {
|
2020-03-08 03:13:30 +03:00
|
|
|
if self.touchpad_to_move {
|
|
|
|
if let Some((scroll_x, scroll_y)) = input.get_mouse_scroll() {
|
|
|
|
if self.lctrl_held {
|
2020-06-18 22:44:47 +03:00
|
|
|
self.zoom(scroll_y, (self.cursor_x, self.cursor_y));
|
2020-03-08 03:13:30 +03:00
|
|
|
} else {
|
|
|
|
// Woo, inversion is different for the two. :P
|
|
|
|
self.cam_x += scroll_x * PAN_SPEED;
|
|
|
|
self.cam_y -= scroll_y * PAN_SPEED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if input.left_mouse_button_pressed() {
|
|
|
|
self.drag_canvas_from = Some((self.get_cursor(), self.get_cursor()));
|
|
|
|
}
|
|
|
|
|
|
|
|
if let Some((_, scroll)) = input.get_mouse_scroll() {
|
2020-06-18 22:44:47 +03:00
|
|
|
self.zoom(scroll, (self.cursor_x, self.cursor_y));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if self.keys_to_pan {
|
|
|
|
if input.new_was_pressed(&hotkey(Key::LeftArrow).unwrap()) {
|
|
|
|
self.cam_x -= PAN_SPEED;
|
|
|
|
}
|
|
|
|
if input.new_was_pressed(&hotkey(Key::RightArrow).unwrap()) {
|
|
|
|
self.cam_x += PAN_SPEED;
|
|
|
|
}
|
|
|
|
if input.new_was_pressed(&hotkey(Key::UpArrow).unwrap()) {
|
|
|
|
self.cam_y -= PAN_SPEED;
|
|
|
|
}
|
|
|
|
if input.new_was_pressed(&hotkey(Key::DownArrow).unwrap()) {
|
|
|
|
self.cam_y += PAN_SPEED;
|
|
|
|
}
|
|
|
|
if input.new_was_pressed(&hotkey(Key::Q).unwrap()) {
|
|
|
|
self.zoom(1.0, (self.window_width / 2.0, self.window_height / 2.0));
|
|
|
|
}
|
|
|
|
if input.new_was_pressed(&hotkey(Key::W).unwrap()) {
|
|
|
|
self.zoom(-1.0, (self.window_width / 2.0, self.window_height / 2.0));
|
2020-03-08 03:13:30 +03:00
|
|
|
}
|
2019-08-06 22:05:09 +03:00
|
|
|
}
|
2018-03-13 18:04:21 +03:00
|
|
|
}
|
2019-12-12 00:52:01 +03:00
|
|
|
|
|
|
|
// If we start the drag on the map and move the mouse off the map, keep dragging.
|
2020-03-03 21:19:37 +03:00
|
|
|
if let Some((click, orig)) = self.drag_canvas_from {
|
2020-01-18 01:11:07 +03:00
|
|
|
let pt = self.get_cursor();
|
2019-12-12 00:52:01 +03:00
|
|
|
self.cam_x += click.x - pt.x;
|
|
|
|
self.cam_y += click.y - pt.y;
|
2020-03-03 21:19:37 +03:00
|
|
|
self.drag_canvas_from = Some((pt, orig));
|
2019-12-12 00:52:01 +03:00
|
|
|
|
|
|
|
if input.left_mouse_button_released() {
|
2020-03-03 21:19:37 +03:00
|
|
|
let (_, orig) = self.drag_canvas_from.take().unwrap();
|
|
|
|
let dist = ((pt.x - orig.x).powi(2) + (pt.y - orig.y).powi(2)).sqrt();
|
|
|
|
if dist > DRAG_THRESHOLD {
|
2019-12-12 00:52:01 +03:00
|
|
|
self.drag_just_ended = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if self.drag_just_ended {
|
|
|
|
self.drag_just_ended = false;
|
2020-05-23 20:42:59 +03:00
|
|
|
} else {
|
|
|
|
let cursor_screen_pt = self.get_cursor().to_pt();
|
|
|
|
let cursor_map_pt = self.screen_to_map(self.get_cursor());
|
|
|
|
let inner_bounds = self.get_inner_bounds();
|
|
|
|
let map_bounds = self.get_map_bounds();
|
2020-06-18 22:44:47 +03:00
|
|
|
if self.edge_auto_panning
|
|
|
|
&& !inner_bounds.contains(cursor_screen_pt)
|
2020-05-23 21:23:38 +03:00
|
|
|
&& map_bounds.contains(cursor_map_pt)
|
|
|
|
{
|
2020-05-23 20:42:59 +03:00
|
|
|
let center_pt = self.center_to_screen_pt().to_pt();
|
|
|
|
let displacement_x = cursor_screen_pt.x() - center_pt.x();
|
|
|
|
let displacement_y = cursor_screen_pt.y() - center_pt.y();
|
2020-05-23 21:23:38 +03:00
|
|
|
let displacement_magnitude =
|
|
|
|
f64::sqrt(displacement_x.powf(2.0) + displacement_y.powf(2.0));
|
2020-05-23 20:42:59 +03:00
|
|
|
let displacement_unit_x = displacement_x / displacement_magnitude;
|
|
|
|
let displacement_unit_y = displacement_y / displacement_magnitude;
|
2020-06-18 22:44:47 +03:00
|
|
|
// Add displacement along each axis
|
2020-05-23 20:42:59 +03:00
|
|
|
self.cam_x += displacement_unit_x * PAN_SPEED;
|
|
|
|
self.cam_y += displacement_unit_y * PAN_SPEED;
|
|
|
|
}
|
2019-12-12 00:52:01 +03:00
|
|
|
}
|
2018-03-13 18:04:21 +03:00
|
|
|
}
|
|
|
|
|
2020-06-18 22:44:47 +03:00
|
|
|
fn zoom(&mut self, delta: f64, focus: (f64, f64)) {
|
|
|
|
let old_zoom = self.cam_zoom;
|
|
|
|
// By popular request, some limits ;)
|
|
|
|
self.cam_zoom = 1.1_f64
|
|
|
|
.powf(old_zoom.log(1.1) + delta)
|
|
|
|
.max(self.min_zoom())
|
|
|
|
.min(150.0);
|
|
|
|
|
|
|
|
// Make screen_to_map of the focus point still point to the same thing after
|
|
|
|
// zooming.
|
|
|
|
self.cam_x = ((self.cam_zoom / old_zoom) * (focus.0 + self.cam_x)) - focus.0;
|
|
|
|
self.cam_y = ((self.cam_zoom / old_zoom) * (focus.1 + self.cam_y)) - focus.1;
|
|
|
|
}
|
|
|
|
|
2019-01-23 03:13:18 +03:00
|
|
|
pub(crate) fn start_drawing(&self) {
|
2018-12-23 05:02:03 +03:00
|
|
|
self.covered_areas.borrow_mut().clear();
|
|
|
|
}
|
|
|
|
|
2020-02-07 23:19:43 +03:00
|
|
|
// TODO Only public for the OSD. :(
|
|
|
|
pub fn mark_covered_area(&self, rect: ScreenRectangle) {
|
2018-12-23 05:02:03 +03:00
|
|
|
self.covered_areas.borrow_mut().push(rect);
|
2018-03-13 18:04:21 +03:00
|
|
|
}
|
|
|
|
|
2020-01-18 01:11:07 +03:00
|
|
|
// Might be hovering anywhere.
|
|
|
|
pub fn get_cursor(&self) -> ScreenPt {
|
2018-12-18 01:29:59 +03:00
|
|
|
ScreenPt::new(self.cursor_x, self.cursor_y)
|
|
|
|
}
|
|
|
|
|
2020-01-18 01:11:07 +03:00
|
|
|
pub fn get_cursor_in_screen_space(&self) -> Option<ScreenPt> {
|
|
|
|
if self.window_has_cursor && self.get_cursor_in_map_space().is_none() {
|
|
|
|
Some(self.get_cursor())
|
|
|
|
} else {
|
|
|
|
None
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-23 03:37:18 +03:00
|
|
|
pub fn get_cursor_in_map_space(&self) -> Option<Pt2D> {
|
2018-12-23 03:58:36 +03:00
|
|
|
if self.window_has_cursor {
|
2020-01-18 01:11:07 +03:00
|
|
|
let pt = self.get_cursor();
|
2018-12-23 05:02:03 +03:00
|
|
|
|
|
|
|
for rect in self.covered_areas.borrow().iter() {
|
|
|
|
if rect.contains(pt) {
|
|
|
|
return None;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Some(self.screen_to_map(pt))
|
2018-12-23 03:58:36 +03:00
|
|
|
} else {
|
|
|
|
None
|
|
|
|
}
|
2018-03-13 18:04:21 +03:00
|
|
|
}
|
|
|
|
|
2018-12-18 01:12:53 +03:00
|
|
|
pub fn screen_to_map(&self, pt: ScreenPt) -> Pt2D {
|
2018-09-19 00:41:30 +03:00
|
|
|
Pt2D::new(
|
2018-12-18 01:12:53 +03:00
|
|
|
(pt.x + self.cam_x) / self.cam_zoom,
|
|
|
|
(pt.y + self.cam_y) / self.cam_zoom,
|
2018-09-19 00:41:30 +03:00
|
|
|
)
|
2018-03-13 18:04:21 +03:00
|
|
|
}
|
|
|
|
|
2018-12-18 01:29:59 +03:00
|
|
|
pub fn center_to_screen_pt(&self) -> ScreenPt {
|
2018-12-21 20:49:46 +03:00
|
|
|
ScreenPt::new(self.window_width / 2.0, self.window_height / 2.0)
|
2018-12-18 01:29:59 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn center_to_map_pt(&self) -> Pt2D {
|
|
|
|
self.screen_to_map(self.center_to_screen_pt())
|
2018-11-12 21:44:24 +03:00
|
|
|
}
|
|
|
|
|
2018-09-19 00:41:30 +03:00
|
|
|
pub fn center_on_map_pt(&mut self, pt: Pt2D) {
|
2018-12-21 20:49:46 +03:00
|
|
|
self.cam_x = (pt.x() * self.cam_zoom) - (self.window_width / 2.0);
|
|
|
|
self.cam_y = (pt.y() * self.cam_zoom) - (self.window_height / 2.0);
|
2018-03-13 18:04:21 +03:00
|
|
|
}
|
|
|
|
|
2020-01-23 02:36:17 +03:00
|
|
|
pub fn map_to_screen(&self, pt: Pt2D) -> ScreenPt {
|
2018-12-18 01:12:53 +03:00
|
|
|
ScreenPt::new(
|
2018-09-19 00:41:30 +03:00
|
|
|
(pt.x() * self.cam_zoom) - self.cam_x,
|
|
|
|
(pt.y() * self.cam_zoom) - self.cam_y,
|
|
|
|
)
|
2018-03-13 18:04:21 +03:00
|
|
|
}
|
|
|
|
|
2020-05-23 20:42:59 +03:00
|
|
|
//the inner bound tells us whether auto-panning should or should not take place
|
|
|
|
fn get_inner_bounds(&self) -> Bounds {
|
|
|
|
let mut b = Bounds::new();
|
|
|
|
b.update(ScreenPt::new(PANNING_THRESHOLD, PANNING_THRESHOLD).to_pt());
|
2020-05-23 21:23:38 +03:00
|
|
|
b.update(
|
|
|
|
ScreenPt::new(
|
|
|
|
self.window_width - PANNING_THRESHOLD,
|
|
|
|
self.window_height - PANNING_THRESHOLD,
|
|
|
|
)
|
|
|
|
.to_pt(),
|
|
|
|
);
|
2020-05-23 20:42:59 +03:00
|
|
|
b
|
|
|
|
}
|
|
|
|
|
|
|
|
fn get_map_bounds(&self) -> Bounds {
|
|
|
|
let mut b = Bounds::new();
|
2020-05-23 21:23:38 +03:00
|
|
|
b.update(Pt2D::new(0.0, 0.0));
|
|
|
|
b.update(Pt2D::new(self.map_dims.0, self.map_dims.1));
|
2020-05-23 20:42:59 +03:00
|
|
|
b
|
|
|
|
}
|
|
|
|
|
2018-11-02 01:29:35 +03:00
|
|
|
pub fn get_screen_bounds(&self) -> Bounds {
|
|
|
|
let mut b = Bounds::new();
|
2018-12-18 01:12:53 +03:00
|
|
|
b.update(self.screen_to_map(ScreenPt::new(0.0, 0.0)));
|
2018-12-21 20:49:46 +03:00
|
|
|
b.update(self.screen_to_map(ScreenPt::new(self.window_width, self.window_height)));
|
2018-11-02 01:29:35 +03:00
|
|
|
b
|
2018-03-13 18:04:21 +03:00
|
|
|
}
|
2019-01-24 00:46:05 +03:00
|
|
|
|
2019-10-27 02:16:32 +03:00
|
|
|
pub fn save_camera_state(&self, map_name: &str) {
|
|
|
|
let state = CameraState {
|
|
|
|
cam_x: self.cam_x,
|
|
|
|
cam_y: self.cam_y,
|
|
|
|
cam_zoom: self.cam_zoom,
|
|
|
|
};
|
2019-12-03 20:59:43 +03:00
|
|
|
abstutil::write_json(abstutil::path_camera_state(map_name), &state);
|
2019-10-27 02:16:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// True if this succeeds
|
|
|
|
pub fn load_camera_state(&mut self, map_name: &str) -> bool {
|
2019-12-03 20:59:43 +03:00
|
|
|
match abstutil::maybe_read_json::<CameraState>(
|
|
|
|
abstutil::path_camera_state(map_name),
|
|
|
|
&mut Timer::throwaway(),
|
|
|
|
) {
|
2019-10-27 02:16:32 +03:00
|
|
|
Ok(ref loaded) => {
|
|
|
|
self.cam_x = loaded.cam_x;
|
|
|
|
self.cam_y = loaded.cam_y;
|
|
|
|
self.cam_zoom = loaded.cam_zoom;
|
|
|
|
true
|
|
|
|
}
|
|
|
|
_ => false,
|
|
|
|
}
|
|
|
|
}
|
2019-12-19 21:59:39 +03:00
|
|
|
|
2020-03-02 23:02:25 +03:00
|
|
|
pub(crate) fn align_window(
|
2019-12-19 21:59:39 +03:00
|
|
|
&self,
|
2020-03-02 23:02:25 +03:00
|
|
|
assets: &Assets,
|
2019-12-19 21:59:39 +03:00
|
|
|
dims: ScreenDims,
|
|
|
|
horiz: HorizontalAlignment,
|
|
|
|
vert: VerticalAlignment,
|
|
|
|
) -> ScreenPt {
|
|
|
|
let x1 = match horiz {
|
|
|
|
HorizontalAlignment::Left => 0.0,
|
|
|
|
HorizontalAlignment::Center => (self.window_width - dims.width) / 2.0,
|
|
|
|
HorizontalAlignment::Right => self.window_width - dims.width,
|
2020-01-14 05:52:44 +03:00
|
|
|
HorizontalAlignment::Percent(pct) => pct * self.window_width,
|
2020-02-05 00:25:53 +03:00
|
|
|
HorizontalAlignment::Centered(x) => x - (dims.width / 2.0),
|
2019-12-19 21:59:39 +03:00
|
|
|
};
|
|
|
|
let y1 = match vert {
|
|
|
|
VerticalAlignment::Top => 0.0,
|
|
|
|
VerticalAlignment::Center => (self.window_height - dims.height) / 2.0,
|
|
|
|
VerticalAlignment::Bottom => self.window_height - dims.height,
|
|
|
|
// TODO Hack
|
2020-03-02 23:02:25 +03:00
|
|
|
VerticalAlignment::BottomAboveOSD => {
|
|
|
|
self.window_height - dims.height - 60.0 * *assets.scale_factor.borrow()
|
|
|
|
}
|
2020-01-14 05:52:44 +03:00
|
|
|
VerticalAlignment::Percent(pct) => pct * self.window_height,
|
2020-02-05 00:25:53 +03:00
|
|
|
VerticalAlignment::Above(y) => y - dims.height,
|
|
|
|
VerticalAlignment::Below(y) => y,
|
2019-12-19 21:59:39 +03:00
|
|
|
};
|
|
|
|
ScreenPt::new(x1, y1)
|
|
|
|
}
|
2018-03-13 18:04:21 +03:00
|
|
|
}
|
2018-09-28 17:52:36 +03:00
|
|
|
|
2019-12-19 21:59:39 +03:00
|
|
|
#[derive(Clone, Copy)]
|
2018-09-28 17:52:36 +03:00
|
|
|
pub enum HorizontalAlignment {
|
|
|
|
Left,
|
|
|
|
Center,
|
|
|
|
Right,
|
2020-01-14 05:52:44 +03:00
|
|
|
Percent(f64),
|
2020-02-05 00:25:53 +03:00
|
|
|
Centered(f64),
|
2018-09-28 17:52:36 +03:00
|
|
|
}
|
|
|
|
|
2019-12-19 21:59:39 +03:00
|
|
|
#[derive(Clone, Copy)]
|
2018-09-28 17:52:36 +03:00
|
|
|
pub enum VerticalAlignment {
|
|
|
|
Top,
|
|
|
|
Center,
|
|
|
|
Bottom,
|
2019-12-19 21:59:39 +03:00
|
|
|
BottomAboveOSD,
|
2020-01-14 05:52:44 +03:00
|
|
|
Percent(f64),
|
2020-02-05 00:25:53 +03:00
|
|
|
Above(f64),
|
|
|
|
Below(f64),
|
2018-09-28 17:52:36 +03:00
|
|
|
}
|
2019-10-27 02:16:32 +03:00
|
|
|
|
|
|
|
#[derive(Serialize, Deserialize, Debug)]
|
|
|
|
pub struct CameraState {
|
|
|
|
cam_x: f64,
|
|
|
|
cam_y: f64,
|
|
|
|
cam_zoom: f64,
|
|
|
|
}
|