mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-21 05:28:13 +08:00
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:
committed by
Keavon Chambers
co-authored by
Dennis
Keavon Chambers
parent
29485001e9
commit
45edeb2a2b
@@ -17,7 +17,7 @@
|
||||
<LayoutCol class="shelf">
|
||||
<LayoutCol class="tools" :scrollableY="true">
|
||||
<ShelfItemInput icon="LayoutSelectTool" title="Select Tool (V)" :active="activeTool === 'Select'" :action="() => selectTool('Select')" />
|
||||
<ShelfItemInput icon="LayoutCropTool" title="Crop Tool" :active="activeTool === 'Crop'" :action="() => (dialog.comingSoon(289), false) && selectTool('Crop')" />
|
||||
<ShelfItemInput icon="LayoutCropTool" title="Crop Tool" :active="activeTool === 'Crop'" :action="() => selectTool('Crop')" />
|
||||
<ShelfItemInput icon="LayoutNavigateTool" title="Navigate Tool (Z)" :active="activeTool === 'Navigate'" :action="() => selectTool('Navigate')" />
|
||||
<ShelfItemInput icon="LayoutEyedropperTool" title="Eyedropper Tool (I)" :active="activeTool === 'Eyedropper'" :action="() => selectTool('Eyedropper')" />
|
||||
|
||||
|
||||
@@ -250,7 +250,7 @@ impl JsEditorHandle {
|
||||
|
||||
let modifier_keys = ModifierKeys::from_bits(modifiers).expect("Invalid modifier keys");
|
||||
|
||||
let message = InputPreprocessorMessage::MouseMove { editor_mouse_state, modifier_keys };
|
||||
let message = InputPreprocessorMessage::PointerMove { editor_mouse_state, modifier_keys };
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ impl JsEditorHandle {
|
||||
|
||||
let modifier_keys = ModifierKeys::from_bits(modifiers).expect("Invalid modifier keys");
|
||||
|
||||
let message = InputPreprocessorMessage::MouseDown { editor_mouse_state, modifier_keys };
|
||||
let message = InputPreprocessorMessage::PointerDown { editor_mouse_state, modifier_keys };
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ impl JsEditorHandle {
|
||||
|
||||
let modifier_keys = ModifierKeys::from_bits(modifiers).expect("Invalid modifier keys");
|
||||
|
||||
let message = InputPreprocessorMessage::MouseUp { editor_mouse_state, modifier_keys };
|
||||
let message = InputPreprocessorMessage::PointerUp { editor_mouse_state, modifier_keys };
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
@@ -515,8 +515,12 @@ impl JsEditorHandle {
|
||||
}
|
||||
|
||||
/// Creates an artboard at a specified point with a width and height
|
||||
pub fn create_artboard_and_fit_to_viewport(&self, top: f64, left: f64, height: f64, width: f64) {
|
||||
let message = ArtboardMessage::AddArtboard { top, left, height, width };
|
||||
pub fn create_artboard_and_fit_to_viewport(&self, pos_x: f64, pos_y: f64, width: f64, height: f64) {
|
||||
let message = ArtboardMessage::AddArtboard {
|
||||
id: None,
|
||||
position: (pos_x, pos_y),
|
||||
size: (width, height),
|
||||
};
|
||||
self.dispatch(message);
|
||||
let message = DocumentMessage::ZoomCanvasToFitAll;
|
||||
self.dispatch(message);
|
||||
|
||||
Reference in New Issue
Block a user