From 606e578b51b06aa54798c933c79583bc27af459f Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 11 Feb 2020 13:22:24 +0100 Subject: [PATCH] Canvas BUG in dragging fixed --- Canvas.js | 18 ++++++++---------- ChartsSpace/EdgeEditor.js | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Canvas.js b/Canvas.js index a9e8bd1f8..49b3c3ab8 100644 --- a/Canvas.js +++ b/Canvas.js @@ -872,13 +872,18 @@ function newCanvas () { browserCanvas.style.cursor = 'grabbing' thisObject.eventHandler.raiseEvent('Dragging', undefined) - if (containerDragStarted || viewPortBeingDragged) { + if (viewPortBeingDragged) { let displaceVector = { x: dragVector.upX - dragVector.downX, y: dragVector.upY - dragVector.downY } - if (containerBeingDragged !== undefined && containerBeingDragged.insideViewport === true) { + if (viewPortBeingDragged) { + canvas.chartSpace.viewport.displace(displaceVector) + } + } + if (containerDragStarted) { + if (containerBeingDragged !== undefined) { let downCopy = { x: dragVector.downX, y: dragVector.downY @@ -899,13 +904,7 @@ function newCanvas () { x: upNoZoom.x - downNoZoom.x, y: upNoZoom.y - downNoZoom.y } - } - if (viewPortBeingDragged) { - canvas.chartSpace.viewport.displace(displaceVector) - } - - if (containerBeingDragged !== undefined) { let moveSucceed = containerBeingDragged.displace(displaceVector) if (moveSucceed === false) { deactivateDragging(event) @@ -913,8 +912,7 @@ function newCanvas () { } } - /* Finally we set the starting point of the new dragVector at this current point. */ - + /* Finally we set the starting point of the new dragVector at this current point. */ dragVector.downX = dragVector.upX dragVector.downY = dragVector.upY } diff --git a/ChartsSpace/EdgeEditor.js b/ChartsSpace/EdgeEditor.js index 7fc921ccd..df2b922ca 100644 --- a/ChartsSpace/EdgeEditor.js +++ b/ChartsSpace/EdgeEditor.js @@ -118,7 +118,7 @@ function newEdgeEditor () { thisObject.container.frame.position.x = 0 thisObject.container.frame.position.y = 0 - // newPosition = transformThisPoint(newPosition, thisObject.container) + // newPosition = thisObject.container.frame.frameThisPoint(newPosition) const MIN_WIDTH = 100 const MIN_HEIGHT = 50