Implement the Crop Tool for artboard resizing (#519)

* Extract transformation cage to a seperate file

* Hook up tool

* Implement resize

* Draw artboards

* centre and constrain

* Bounding box is rotated

* Fix transform handle positions for artboard

* Drag layers

* Snapping

* Fix imports

* Cleanup

* Remove allocation from bounding_boxes

* Round artboard size and position

* Hints

* Fix rotated transform cage

* Code review changes

* Hints changes

Co-authored-by: Dennis <dennis@kobert.dev>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
0HyperCube
2022-02-09 23:22:23 +00:00
committed by Keavon Chambers
co-authored by Dennis Keavon Chambers
parent 29485001e9
commit 45edeb2a2b
29 changed files with 817 additions and 340 deletions
+5 -5
View File
@@ -28,7 +28,7 @@ pub enum NavigateMessage {
ClickZoom {
zoom_in: bool,
},
MouseMove {
PointerMove {
snap_angle: Key,
snap_zoom: Key,
},
@@ -66,7 +66,7 @@ impl<'a> MessageHandler<ToolMessage, ToolActionHandlerData<'a>> for Navigate {
match self.fsm_state {
Ready => actions!(NavigateMessageDiscriminant; TranslateCanvasBegin, RotateCanvasBegin, ZoomCanvasBegin),
_ => actions!(NavigateMessageDiscriminant; ClickZoom, MouseMove, TransformCanvasEnd),
_ => actions!(NavigateMessageDiscriminant; ClickZoom, PointerMove, TransformCanvasEnd),
}
}
}
@@ -111,7 +111,7 @@ impl Fsm for NavigateToolFsmState {
ClickZoom { zoom_in } => {
messages.push_front(MovementMessage::TransformCanvasEnd.into());
// Mouse has not moved from mousedown to mouseup
// Mouse has not moved from pointerdown to pointerup
if data.drag_start == input.mouse.position {
messages.push_front(if zoom_in {
MovementMessage::IncreaseCanvasZoom { center_on_mouse: true }.into()
@@ -122,9 +122,9 @@ impl Fsm for NavigateToolFsmState {
NavigateToolFsmState::Ready
}
MouseMove { snap_angle, snap_zoom } => {
PointerMove { snap_angle, snap_zoom } => {
messages.push_front(
MovementMessage::MouseMove {
MovementMessage::PointerMove {
snap_angle,
wait_for_snap_angle_release: false,
snap_zoom,