mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-26 02:38:13 +08:00
Allow groups to work with the node graph (#1452)
* Initial groups * Improve graph arangement * Fix selecting nested layers * Code review pass * Change log --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
co-authored by
Keavon Chambers
parent
f4ec76f35e
commit
58660f5548
@@ -5,6 +5,7 @@
|
||||
use crate::helpers::{translate_key, Error};
|
||||
use crate::{EDITOR_HAS_CRASHED, EDITOR_INSTANCES, JS_EDITOR_HANDLES};
|
||||
|
||||
use document_legacy::document_metadata::LayerNodeIdentifier;
|
||||
use document_legacy::LayerId;
|
||||
use editor::application::generate_uuid;
|
||||
use editor::application::Editor;
|
||||
@@ -546,11 +547,9 @@ impl JsEditorHandle {
|
||||
/// Move a layer to be next to the specified neighbor
|
||||
#[wasm_bindgen(js_name = moveLayerInTree)]
|
||||
pub fn move_layer_in_tree(&self, folder_path: Vec<LayerId>, insert_index: isize) {
|
||||
let message = DocumentMessage::MoveSelectedLayersTo {
|
||||
folder_path,
|
||||
insert_index,
|
||||
reverse_index: true,
|
||||
};
|
||||
let parent = folder_path.last().copied().map(LayerNodeIdentifier::new_unchecked).unwrap_or(LayerNodeIdentifier::ROOT);
|
||||
|
||||
let message = DocumentMessage::MoveSelectedLayersTo { parent, insert_index };
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
@@ -654,7 +653,7 @@ impl JsEditorHandle {
|
||||
#[wasm_bindgen(js_name = selectNodes)]
|
||||
pub fn select_nodes(&self, nodes: Option<Vec<u64>>) {
|
||||
let nodes = nodes.unwrap_or_default();
|
||||
let message = NodeGraphMessage::SetSelectedNodes { nodes };
|
||||
let message = NodeGraphMessage::SelectedNodesSet { nodes };
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user