Skip to content

Fix node deletion using NodeToolbar trash icon #1

@luisjakon

Description

@luisjakon

Hello,

Just wanted to provide this nugget that allowed me to successfully delete a node and corresponding connections from the scene by clicking on the trash icon. Without this, it would not do anything.

Thnxs for your work on this!

diff --git a/dev/components/NodeToolbar.tsx b/dev/components/NodeToolbar.tsx
index 8c1b178..75b0b46 100644
--- a/dev/components/NodeToolbar.tsx
+++ b/dev/components/NodeToolbar.tsx
@@ -18,6 +18,7 @@ const NodeToolbar = (props: {
                                 (c) => c.from.id !== n_id && c.to.id !== n_id,
                         ),
                 );
+                props.kit.updateConnections();
                 // TODO: tracker
                 props.kit.setNodes((prev) => prev.filter((n) => n.id !== n_id));
                 props.kit.updateNodes();
@@ -40,7 +41,7 @@ const NodeToolbar = (props: {
                         class="kitx-controls"
                         style={{ "--flex-direction": "row" }}
                 >
-                        <button onpointerdown={removeNode} title="Remove Node">
+                        <button onpointerdown={removeNode} title="Remove Node" style="pointer-events: all;">
                                 <svg
                                         xmlns="http://www.w3.org/2000/svg"
                                         viewBox="0 0 24 24"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions