jgraph / mxgraph

mxGraph is a fully client side JavaScript diagramming library
Other
6.81k stars 2.06k forks source link

SelectionModel listener is opposite (added <--> removed) #461

Closed peleyal closed 3 years ago

peleyal commented 4 years ago

Hi guys! First of all this library is so rich, I like it as it gives me a lot of flexibility to do what I want.

I noticed something pretty awkward in the selection model listener. I'm doing something like the following:

 graph.getSelectionModel().addListener(
        mxEvent.CHANGE, (sender, evt) => {
  const added = evt.getProperty('added');
  if (added && added.length > 0) {
    // adding some overlays to selected cell...
   }
  const removed = evt.getProperty('removed');
  if (removed && removed.length > 0) {
    // removing overlays...
  }
});

However! I noticed that the added property actually includes elements that are being removed from selection, while the removed one includes elements that are being added.

So currently what I'm doing is const removedCell = added[0]; and const addedCell = removed[0]; (as I only allow a single selection).

Can you please check that out? I hope that I'm not using something wrong...

Thanks! Eyal

peleyal commented 3 years ago

Can you please explain why this one was closed? Couldn't you reproduce it?

davidjgraph commented 3 years ago

We've ceased development on the project.