mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-03 04:52:16 +00:00
Implement artboards and document version enforcement (#466)
* - graphite document artboard implementation - autosave document load hitch fix - Autosave will delete saved files when graphite document version changes * formating * - top left 0,0 - fixed hitch on first document - vue calls first render * Revert * Merge branch 'master' into artboards * Small bug fixes and code review tweaks Co-authored-by: Oliver Davies <oliver@psyfer.io> Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
parent
3f3ffbc82c
commit
439418896a
17 changed files with 218 additions and 33 deletions
|
@ -6,7 +6,7 @@ use std::sync::atomic::Ordering;
|
|||
use crate::helpers::Error;
|
||||
use crate::type_translators::{translate_blend_mode, translate_key, translate_tool_type, translate_view_mode};
|
||||
use crate::{EDITOR_HAS_CRASHED, EDITOR_INSTANCES};
|
||||
use editor::consts::FILE_SAVE_SUFFIX;
|
||||
use editor::consts::{FILE_SAVE_SUFFIX, GRAPHITE_DOCUMENT_VERSION};
|
||||
use editor::input::input_preprocessor::ModifierKeys;
|
||||
use editor::input::mouse::{EditorMouseState, ScrollDelta, ViewportBounds};
|
||||
use editor::message_prelude::*;
|
||||
|
@ -503,6 +503,12 @@ impl JsEditorHandle {
|
|||
let message = DocumentMessage::CreateEmptyFolder(path);
|
||||
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) {
|
||||
let message = ArtboardMessage::AddArtboard { top, left, height, width };
|
||||
self.dispatch(message);
|
||||
}
|
||||
}
|
||||
|
||||
// Needed to make JsEditorHandle functions pub to rust. Do not fully
|
||||
|
@ -537,6 +543,11 @@ pub fn file_save_suffix() -> String {
|
|||
FILE_SAVE_SUFFIX.into()
|
||||
}
|
||||
|
||||
/// Get the constant FILE_SAVE_SUFFIX
|
||||
#[wasm_bindgen]
|
||||
pub fn graphite_version() -> String {
|
||||
GRAPHITE_DOCUMENT_VERSION.to_string()
|
||||
}
|
||||
/// Get the constant i32::MAX
|
||||
#[wasm_bindgen]
|
||||
pub fn i32_max() -> i32 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue