How do I handle the events of the haldle provided by halo? #2875
Unanswered
james-ep01
asked this question in
Q&A
Replies: 2 comments
-
|
The Note that in v4.1 you can use the |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
It works well, thank you. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Introduction
How do I handle the click event (pointerdown) of the haldle provided by halo? For example, when deleting, I ask for confirmation and then delete it.
I tried changeHandle as below, but it doesn't work.
const halo = new joint.ui.Halo(options);
halo.changeHandle({
name: 'remove',
position: 'se' ,
events: {
pointerdown: function (evt, x, y) {
if( confirm("Remove this ...... ?") ){
cell.remove();
}
}
},
});
The code below also confirms, but it doesn't and is forcibly deleted.
halo.on('action:remove:pointerdown', (evt,x,y) => {
evt.stopPropagation();
if( confirm("Remove this............") ){
cell.remove();
}
});
I tried removing and addingHandle again because changeHandle didn't work, and it worked. Is this the right way?
Or can I access it by redefining it without removing it?
const halo = new joint.ui.Halo(options);
halo.removeHandle('remove'); halo.addHandle({
name: 'remove',
position: 'se',
events: {
pointerdown: function (evt, x, y) {
if( confirm("Remove this ...... ?") ){
cell.remove();
}
}
},
});
Steps to reproduce
No response
Restrictions & Constraints
No response
Does your question relate to JointJS or JointJS+. Select both if applicable.
JointJS, JointJS+
Beta Was this translation helpful? Give feedback.
All reactions