mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-08-03 21:08:18 +00:00
Add a node insertion button and layer renaming from the Properties panel (#2072)
* Add node button * Improve css a bit * Add layer renaming to the Properties panel and move New Layer to that, plus add unpinning to properties sections * Add tooltip * Re-add layer itself in listing * Final code review --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
parent
3c839ffd2b
commit
5aa6716910
24 changed files with 389 additions and 264 deletions
|
@ -652,20 +652,16 @@ impl EditorHandle {
|
|||
self.dispatch(message);
|
||||
}
|
||||
|
||||
/// Unpin a node given its node ID
|
||||
#[wasm_bindgen(js_name = unpinNode)]
|
||||
pub fn unpin_node(&self, id: u64) {
|
||||
self.dispatch(DocumentMessage::SetNodePinned { node_id: NodeId(id), pinned: false });
|
||||
}
|
||||
|
||||
/// Delete a layer or node given its node ID
|
||||
#[wasm_bindgen(js_name = deleteNode)]
|
||||
pub fn delete_node(&self, id: u64) {
|
||||
let message = DocumentMessage::StartTransaction;
|
||||
self.dispatch(message);
|
||||
|
||||
let id = NodeId(id);
|
||||
self.dispatch(NodeGraphMessage::DeleteNodes {
|
||||
node_ids: vec![id],
|
||||
delete_children: true,
|
||||
});
|
||||
self.dispatch(NodeGraphMessage::RunDocumentGraph);
|
||||
self.dispatch(NodeGraphMessage::SelectedNodesUpdated);
|
||||
self.dispatch(NodeGraphMessage::SendGraph);
|
||||
self.dispatch(DocumentMessage::DeleteNode { node_id: NodeId(id) });
|
||||
}
|
||||
|
||||
/// Toggle lock state of a layer from the layer list
|
||||
|
@ -693,11 +689,7 @@ impl EditorHandle {
|
|||
/// Toggle display type for a layer
|
||||
#[wasm_bindgen(js_name = setToNodeOrLayer)]
|
||||
pub fn set_to_node_or_layer(&self, id: u64, is_layer: bool) {
|
||||
let node_id = NodeId(id);
|
||||
let message = DocumentMessage::StartTransaction;
|
||||
self.dispatch(message);
|
||||
let message = NodeGraphMessage::SetToNodeOrLayer { node_id, is_layer };
|
||||
self.dispatch(message);
|
||||
self.dispatch(DocumentMessage::SetToNodeOrLayer { node_id: NodeId(id), is_layer });
|
||||
}
|
||||
|
||||
#[wasm_bindgen(js_name = injectImaginatePollServerStatus)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue