2012-09-06 36 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)); 
  • 经过上述修改后,问题就解决了,我可能是错的。请纠正我,因为我没有深入测试它,但它的工作。我需要你的指导。对不起,改变了代码。

感谢你这么多:)