2012-07-19 12 views
0

這裏是撤消/重做的例子:Undo_Redo_Delete如何在刪除節點後控制連接?

我沒有以下步驟:

  1. 拖放開始和結束節點。
  2. 通過端口連接它們。
  3. 刪除結束節點。
  4. 現在再次拖動結束節點。
  5. 這一次,我再次嘗試連接開始和結束點,但它表明

類型錯誤:this.parent.getCanvas()爲null

在this.parent.getCanvas()connectionLine。 port.js的setGlow(false)

如果有任何身體知道如何解決這個問題,請您幫助me.Thanks提前:)

回答

1

固定版本0.9.38

您可以用下面的代碼,如果你需要更換onDragEnd方法快速修復。

/** 
* @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 
}, 
+0

非常感謝Andreas現在工作正常,很高興看到您的回覆...... :) – 2012-08-21 06:37:56