Add persistence to the collapsed state of Properties panel node sections (#4300)

* Add persistence to the collapsed state of Properties panel node sections

* Improve comments

* Fix generator node handling with #4299
This commit is contained in:
Keavon Chambers
2026-07-01 04:54:39 -07:00
committed by GitHub
parent 1648e33c1f
commit 7ae7bda3d3
10 changed files with 86 additions and 18 deletions

View File

@@ -13,7 +13,8 @@
export { className as class };
export let classes: Record<string, boolean> = {};
let expanded = true;
// Whether the section is expanded is owned by the backend (persisted per node), so just reflect it here
$: expanded = widgetData.expanded;
// A reorderable section is a Properties panel node section the user can drag to reorder (a layer chain's node, or a pinned node)
$: reorderable = layoutTarget === "PropertiesPanel" && widgetData.draggable;
@@ -23,7 +24,13 @@
<!-- TODO: Implement collapsable sections with properties system -->
<LayoutCol class={`widget-section ${className}`.trim()} {classes} data-properties-reorderable-section={reorderable ? "" : undefined} data-node-id={reorderable ? String(widgetData.id) : undefined}>
<button class="header" class:expanded data-properties-reorder-handle={reorderable ? "" : undefined} on:click|stopPropagation={() => (expanded = !expanded)} tabindex="0">
<button
class="header"
class:expanded
data-properties-reorder-handle={reorderable ? "" : undefined}
on:click|stopPropagation={() => editor.toggleNodePropertiesSectionExpanded(widgetData.id)}
tabindex="0"
>
<div class="expand-arrow"></div>
<TextLabel tooltipLabel={widgetData.name} tooltipDescription={widgetData.description} bold={true}>{widgetData.name}</TextLabel>
<IconButton

View File

@@ -931,6 +931,12 @@ impl EditorWrapper {
self.dispatch(DocumentMessage::SetNodePinned { node_id: NodeId(id), pinned });
}
/// Collapse or expand a node's section in the Properties panel
#[wasm_bindgen(js_name = toggleNodePropertiesSectionExpanded)]
pub fn toggle_node_properties_section_expanded(&self, id: u64) {
self.dispatch(DocumentMessage::ToggleNodePropertiesSectionExpanded { node_id: NodeId(id) });
}
/// Delete a layer or node given its node ID
#[wasm_bindgen(js_name = deleteNode)]
pub fn delete_node(&self, id: u64) {