mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-04 13:30:48 +00:00
Fix bounds with artboards for zoom-to-fit and scrollbar scaling (#473)
* - document load keeps postition - zoom to fit - scrollbars use artboard dimensions * - review comments - svg export uses all artboard bounds Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
parent
9089a25199
commit
9d2718006f
8 changed files with 94 additions and 53 deletions
|
@ -71,7 +71,7 @@ function makeMenuEntries(editor: EditorState): MenuListEntries {
|
|||
icon: "File",
|
||||
action: (): void => {
|
||||
editor.instance.new_document();
|
||||
editor.instance.create_artboard(0, 0, 1920, 1080);
|
||||
editor.instance.create_artboard_and_fit_to_viewport(0, 0, 1920, 1080);
|
||||
},
|
||||
},
|
||||
{ label: "Open…", shortcut: ["KeyControl", "KeyO"], action: (): void => editor.instance.open_document() },
|
||||
|
|
|
@ -504,10 +504,12 @@ impl JsEditorHandle {
|
|||
self.dispatch(message);
|
||||
}
|
||||
|
||||
// Creates an artboard at a specified point with a width and height
|
||||
pub fn create_artboard(&self, top: f64, left: f64, height: f64, width: f64) {
|
||||
/// 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 };
|
||||
self.dispatch(message);
|
||||
let message = DocumentMessage::ZoomCanvasToFitAll;
|
||||
self.dispatch(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue