From 39e6893630fd68600c0d4ccaba3771743af211da Mon Sep 17 00:00:00 2001
From: 0HyperCube <78500760+0HyperCube@users.noreply.github.com>
Date: Tue, 13 Jul 2021 07:50:10 +0100
Subject: [PATCH] Viewport canvas navigation with modifier keys and zoom widget
(#229)
* Add rotation around the center
* Document transform centred
* Fix drawing hexagon on rotated document
* Format
* Fix translation on rotated document
* Remove logging
* Rotate around centre of viewport
* Rotate with shift + MMB drag
* Zoom with +/- keys
* Rotation input field
* Implement frontend zoom buttons
* Zoom with ctrl + MMB
* Format
* Update number inputs
* Require Ctrl + Plus / Minus key
* Ctrl scroll
* Update zoom -> Multiply Zoom
* Fix typo
* More fixing typo
* Remove :v-on
* Add mouse scroll X
* Scrolling on document
* Refactor
* Format
* Fix ctrl + plus/minus to zoom
* Reduce zoom sensitivity
* Ctrl + shift + mmb drag = snap rotate
* Further reduce zoom speed
* Add ctrl + number key to change zoom
* Switch Ctrl and Shift for zoom and rotate
* Fix compile errors
* Format JS
* Add increment to snap angle
* Edit getting layerdata functions
* Pass viewport size directily into create_document_transform_from_layerdata
* Add to_dvec2()
* Refactor get_transform
* Get -> Calculate
* Add consts
* Use to_radians
* Remove get from function names
* Use .entry when getting layerdata that does not exist
* Fix distance scroll calculations
* Fix zooming.
* Remove 'Violation' in chrome
* Fix compile errors
---
client/web/src/components/panels/Document.vue | 54 +++++-
.../components/widgets/inputs/NumberInput.vue | 54 ++++--
client/web/src/response-handler.ts | 28 +++-
client/web/wasm/src/document.rs | 32 ++++
client/web/wasm/src/wrappers.rs | 3 +
core/document/src/document.rs | 7 +
core/document/src/layers/shape.rs | 14 +-
core/document/src/operation.rs | 4 +
core/editor/Cargo.toml | 4 +-
core/editor/src/communication/dispatcher.rs | 2 +
core/editor/src/consts.rs | 7 +
core/editor/src/document/document_file.rs | 46 +++++-
.../src/document/document_message_handler.rs | 156 ++++++++++++++++--
.../src/frontend/frontend_message_handler.rs | 4 +
core/editor/src/frontend/layer_panel.rs | 2 +-
core/editor/src/input/input_mapper.rs | 24 ++-
core/editor/src/input/input_preprocessor.rs | 34 +++-
core/editor/src/input/keyboard.rs | 3 +
core/editor/src/input/mouse.rs | 27 ++-
core/editor/src/lib.rs | 2 +
core/editor/src/misc/test_utils.rs | 4 +-
core/editor/src/tool/tools/pen.rs | 4 +-
22 files changed, 442 insertions(+), 73 deletions(-)
create mode 100644 core/editor/src/consts.rs
diff --git a/client/web/src/components/panels/Document.vue b/client/web/src/components/panels/Document.vue
index c1182739f..e3cc36ce3 100644
--- a/client/web/src/components/panels/Document.vue
+++ b/client/web/src/components/panels/Document.vue
@@ -88,13 +88,17 @@
-
-
-
+
+
+
+
+
+
+
-
+
@@ -135,7 +139,7 @@
-