Can have more than one time machine and drag it around
This commit is contained in:
1 parent
32a0abfbe7
commit
5c4876df35
5 files changed
+40
-23
No files matched your search
@@ -850,30 +850,34 @@ function newCanvas () {
|
||||
thisObject.eventHandler.raiseEvent('Dragging', undefined)
|
||||
|
||||
if (containerDragStarted || viewPortBeingDragged) {
|
||||
/* The parameters received have been captured with zoom applied. We must remove the zoom in order to correctly modify the displacement. */
|
||||
|
||||
let downCopy = {
|
||||
x: dragVector.downX,
|
||||
y: dragVector.downY
|
||||
}
|
||||
|
||||
let downCopyNoTransf
|
||||
downCopyNoTransf = viewPort.unzoomThisPoint(downCopy)
|
||||
// downCopyNoTransf = containerBeingDragged.zoom.unzoomThisPoint(downCopyNoTransf);
|
||||
|
||||
let upCopy = {
|
||||
x: dragVector.upX,
|
||||
y: dragVector.upY
|
||||
}
|
||||
|
||||
let upCopyNoTranf
|
||||
upCopyNoTranf = viewPort.unzoomThisPoint(upCopy)
|
||||
|
||||
let displaceVector = {
|
||||
x: dragVector.upX - dragVector.downX,
|
||||
y: dragVector.upY - dragVector.downY
|
||||
}
|
||||
|
||||
if (containerBeingDragged !== undefined && containerBeingDragged.insideViewport === true) {
|
||||
let downCopy = {
|
||||
x: dragVector.downX,
|
||||
y: dragVector.downY
|
||||
}
|
||||
|
||||
let downNoZoom
|
||||
downNoZoom = viewPort.unzoomThisPoint(downCopy)
|
||||
|
||||
let upCopy = {
|
||||
x: dragVector.upX,
|
||||
y: dragVector.upY
|
||||
}
|
||||
|
||||
let upNoZoom
|
||||
upNoZoom = viewPort.unzoomThisPoint(upCopy)
|
||||
|
||||
displaceVector = {
|
||||
x: upNoZoom.x - downNoZoom.x,
|
||||
y: upNoZoom.y - downNoZoom.y
|
||||
}
|
||||
}
|
||||
|
||||
if (viewPortBeingDragged) {
|
||||
viewPort.displace(displaceVector)
|
||||
}
|
||||
|
||||
@@ -48,7 +48,8 @@ function newTimeMachine () {
|
||||
function setupContainer () {
|
||||
thisObject.container = newContainer()
|
||||
thisObject.container.initialize(MODULE_NAME)
|
||||
thisObject.container.isDraggeable = false
|
||||
thisObject.container.isDraggeable = true
|
||||
thisObject.container.insideViewport = true
|
||||
thisObject.container.detectMouseOver = true
|
||||
|
||||
thisObject.container.frame.width = TIME_MACHINE_WIDTH
|
||||
@@ -329,7 +330,7 @@ function newTimeMachine () {
|
||||
if (thisObject.timeScale !== undefined) { thisObject.timeScale.draw() }
|
||||
if (thisObject.rateScale !== undefined) { thisObject.rateScale.draw() }
|
||||
|
||||
// thisObject.container.frame.draw(false, true, false)
|
||||
thisObject.container.frame.draw(false, true, false, thisObject.fitFunction)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -211,6 +211,11 @@ function newContainer () {
|
||||
return true
|
||||
}
|
||||
break
|
||||
case GET_CONTAINER_PURPOSE.DRAGGING:
|
||||
if (thisObject.isDraggeable === true) {
|
||||
return true
|
||||
}
|
||||
break
|
||||
default: { return false }
|
||||
|
||||
}
|
||||
|
||||
+2
-1
@@ -48,7 +48,8 @@ const MIN_ZOOM_LEVEL = -28.25
|
||||
const GET_CONTAINER_PURPOSE = {
|
||||
MOUSE_OVER: 1,
|
||||
MOUSE_WHEEL: 2,
|
||||
MOUSE_CLICK: 3
|
||||
MOUSE_CLICK: 3,
|
||||
DRAGGING: 4
|
||||
}
|
||||
|
||||
/* User Interface Panels */
|
||||
|
||||
@@ -76,7 +76,13 @@ function newChartSpace () {
|
||||
for (let i = 0; i < thisObject.timeMachines.length; i++) {
|
||||
container = thisObject.timeMachines[i].getContainer(point, purpose)
|
||||
if (container !== undefined) {
|
||||
if (container.isForThisPurpose(purpose)) {
|
||||
if (purpose !== undefined) {
|
||||
if (container.isForThisPurpose(purpose)) {
|
||||
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
|
||||
return container
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
|
||||
return container
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user