0

Here is the example of Undo/Redo : Undo_Redo_Delete

I did the following steps :

  1. Drag and Drop start and end nodes.
  2. Connect them via ports.
  3. Delete end node.
  4. Now again drag end node.
  5. This time I again try to connect start and end node , but it shows

TypeError: this.parent.getCanvas() is null

at this.parent.getCanvas().connectionLine.setGlow(false) of port.js.

If any body know how to overcome this problem then please help me.Thanks in advance:)

Jan Krakora
  • 2,500
  • 3
  • 25
  • 52
JS Rocker
  • 148
  • 1
  • 1
  • 10

1 Answers1

1

fixed with version 0.9.38

You can replace the onDragEnd method with the code below if you need a quick fix.

/**
 * @inheritdoc
 **/
onDragEnd:function()
{
  this.parent.getCanvas().setSnapToGrid(this.originalSnapToGrid );
  this.parent.getCanvas().setSnapToGeometry( this.originalSnapToGeometry );

  // Don't call the parent implementation. This will create an CommandMove object
  // and store them o the CommandStack for the undo operation. This makes no sense for a
  // port.
  // graphiti.shape.basic.Rectangle.prototype.onDragEnd.call(this); DON'T call the super implementation!!!

  this.setAlpha(1.0);

  // 1.) Restore the old Position of the node
  //
  this.setPosition(this.ox,this.oy);

  // 2.) Remove the bounding line from the canvas
  //
  this.parent.getCanvas().hideConnectionLine();
  this.isInDragDrop =false;

  // Reset the drag&drop flyover information 
  //
  this.currentTarget = null; // <<== this is the missing line to fix the bug
},