cutSelection vs deleteSelection within SelectionDeleting Event handler

Hi Team,

I have recently started working with GoJS to create some custom diagrams. I have created specific icons for managing edit operations on the diagram like add, cut, copy, paste, delete etc.,

I was able to achieve most of the functionality by referring to GoJS docs & forum, but there is one issue which i couldn’t figure out, how to figure out the which operation triggered deletion of the node on the diagram, Cut or Delete ?

I am doing some custom changes wrt to cut and delete within “SelectionDeleting” event handler, but i am unable to figure the source of the deletion event.

FYI, i can figure out the source from call stack of the dev tools, is that info available within the event object of “SelectionDeleting” event handler.

any quick help would be really appreciated.

thanks,
Manoj Kumar L

Here is how CommandHandler.cutSelection is defined:

CommandHandler.prototype.cutSelection = function() {
  this.copySelection();
  this.deleteSelection();
};

I suppose you could override this so that you can know that your cutSelection was called.

1 Like

Thanks walter.

this way i might have to maintain a flag for myself to identify between cut and delete, which kind of seems like a overkill, because for me delete operation contains several sequence of internal steps that i am carrying out specific to my app.

if this is the only way to do it, then i will continue with this approach.

once again thanks for your quick response, i appreciate it :)