2012-09-06 69 views
0

在這個例子中:Undo/Redo如何克服端口分離問題?

  • 拖放到畫布上的開始節點。
  • Mousedown在港口並拖動它。
  • 現在拖動時按RIGHT CLICK。

現在的問題是,該端口成爲從起始節點分離。它不應該發生。

請看下圖以獲得更好的理解。 請幫我解決這個問題。 在此先感謝。

enter image description here

回答

0

這是一個錯誤,將被固定在未來的版本中的一個。

+0

請詳細說明這一點,並附上可靠的來源參考。 –

1

我已經仔細分析這個問題,得出的結論爲:

  • 問題是鼠標按下和鼠標最多。
  • 正如我已經看到,當我有鼠標停下來,並拖動端口,然後按下鼠標右鍵。 然後發生什麼事是在canvas.js中調用鼠標。
  • 然後,當鼠標右鍵上移,然後鼠標移動canvas.js調用並使mouseDown = false。

    this.html.bind("mouseup touchend", $.proxy(function(event) 
        { 
         if (this.mouseDown === false) 
          return; 
    
         event = this._getEvent(event); 
    
         this.mouseDown = false;// it makes mouseDown false 
         this.onMouseUp(); 
        }, this)); 
    
  • 所以對於知道速戰速決我已經ckecked如果鼠標右鍵彈起時,右鼠標下來,然後返回爲:

在按下鼠標:

this.html.bind("mousedown touchstart", $.proxy(function(event) 
     {     
      event.preventDefault(); 

      if(event.which == 3)//added this in the mouse down 
       return; 

      event = this._getEvent(event); 

      this.mouseDownX = event.clientX; 
      this.mouseDownY = event.clientY; 
      var pos = this.fromDocumentToCanvasCoordinate(event.clientX, event.clientY); 
      this.mouseDown = true; 
      this.onMouseDown(pos.x, pos.y); 
    }, this)); 

在鼠標釋放:

this.html.bind("mouseup touchend", $.proxy(function(event) 
     { 
      //added extra condition for right click 
      if (this.mouseDown === false || event.which == 3) 
       return; 

      event = this._getEvent(event); 

      this.mouseDown = false;// it makes mouseDown false 
      this.onMouseUp(); 
     }, this)); 
  • 經過上述修改後,問題就解決了,我可能是錯的。請糾正我,因爲我沒有深入測試它,但它的工作。我需要你的指導。對不起,改變了代碼。

感謝你這麼多:)