Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delete/deselect nodes question #2

Closed
HeSe opened this issue Jan 26, 2016 · 3 comments
Closed

delete/deselect nodes question #2

HeSe opened this issue Jan 26, 2016 · 3 comments

Comments

@HeSe
Copy link

HeSe commented Jan 26, 2016

Hi!

I have two questions.

Why is it necessary to set the node.id to -1 in LGraph.prototype.remove = function(node)?
I have implemented a onNodeRemoved(node) in my editor and the id is set to -1 my editor does not more find the particular node in it's own node collections.

Why does onNodeDeselected() not have a parameter? I changed it to onNodeDeselected(n) in all calling parts in litegraph.js in order to have my editor to be able to react on deselection of particular nodes.

Well, great work by the way. I think I will soon add some minor pull requests once I understand your intentions a little better.

Thanks
Sebastian

@jagenjo
Copy link
Owner

jagenjo commented Jan 26, 2016

You are right, the -1 I guess comes from when the very beginning when the id was the position in the nodes array, but thats no longer true so I removed the line.
I also added the node on onNodeDeselected. :)

@HeSe
Copy link
Author

HeSe commented Jan 26, 2016

Thank you!
And one more since we are at it....

How do you use the node methodes onDeselected/onSelected.
I find it difficult to access those to define behavior on Node level.
Do you have an example you can point at?

@jagenjo
Copy link
Owner

jagenjo commented Jan 26, 2016

What do you want to do? to use you must just add a callback in the node:
this.onSelected = function() { ... }

@jagenjo jagenjo closed this as completed Oct 27, 2018
moritz89 added a commit to moritz89/litegraph.js that referenced this issue Mar 20, 2023
…cks-and-prune-some-unused-styles

add generic font fallbacks and prune some unused styles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants