@neilspragg wrote:
Hi
I have a palette and a canvas setup. I drag from the palette to the canvas and its all good. If I drag a node from the palette to the canvas and there is already a node with the same key, it sets the newly dragged node key to a negative number. I can deal with that and remove the dragged node with the negative key, still all good. Separately, I have implemented an undo function where I set the canvas model back to a prior state (see below), also all good. The problem comes when I do both these things. When I have a specific node on the canvas and I undo to a prior state the node is gone, I then drag this same node from the palette to the canvas and I get a negative key even though the node is gone. Very strange. Can you advise if I am doing something wrong.
My undo code:
\
if (_undoStack.length > 0) {
_baseDiag.clear();
_baseDiag.model = go.Model.fromJson(_undoStack.pop());
}
\\
Posts: 17
Participants: 2