snap to grid finished, bug fixed

This commit is contained in:
Luis Fernando Molina committed 2020-03-07 15:54:19 +01:00
1 parent 36c40bb3f1
commit 45a86d05cd
1 file changed
+7 -6
+7 -6
View File
@@ -238,14 +238,15 @@ function newEdgeEditor () {
}
case 'left mouse button': {
let point = {
x: -dragVector.x,
y: -dragVector.y
x: (-dragVectorWhenDragStarted.x),
y: (-dragVectorWhenDragStarted.y)
}
let newMinDate = getDateFromPointAtContainer(point, thisObject.container.parentContainer, coordinateSystem)
let newMaxRate = getRateFromPointAtContainer(point, thisObject.container.parentContainer, coordinateSystem)
let xDifferenceMaxMin = coordinateSystem.max.x - coordinateSystem.min.x
let yDifferenceMaxMin = coordinateSystem.max.y - coordinateSystem.min.y
let newMinDate = getDateFromPointAtContainer(point, thisObject.container.parentContainer, coordinateSystemWhenDragStarted)
let newMaxRate = getRateFromPointAtContainer(point, thisObject.container.parentContainer, coordinateSystemWhenDragStarted)
let xDifferenceMaxMin = coordinateSystemWhenDragStarted.max.x - coordinateSystemWhenDragStarted.min.x
let yDifferenceMaxMin = coordinateSystemWhenDragStarted.max.y - coordinateSystemWhenDragStarted.min.y
coordinateSystem.min.x = newMinDate.valueOf()
coordinateSystem.max.x = newMinDate.valueOf() + xDifferenceMaxMin
coordinateSystem.min.y = newMaxRate - yDifferenceMaxMin