Dragging on one axis is now possible

This commit is contained in:
Luis Fernando Molina committed 2019-05-10 09:29:04 +02:00
1 parent 2b49bbad2c
commit 6301102a79
3 files changed
+23 -10

No files matched your search

+7 -2
View File
@@ -173,6 +173,7 @@ function newCanvas () {
animation.addCallBackFunction('Panels Space', thisObject.panelsSpace.draw, onFunctionAdded)
animation.addCallBackFunction('ViewPort Animate', viewPort.animate, onFunctionAdded)
animation.addCallBackFunction('Bottom Space', thisObject.bottomSpace.draw, onFunctionAdded)
animation.addCallBackFunction('Bottom Space Physics', thisObject.bottomSpace.physics, onFunctionAdded)
animation.addCallBackFunction('Top Space', thisObject.topSpace.draw, onFunctionAdded)
animation.addCallBackFunction('Strategy Space', thisObject.strategySpace.draw, onFunctionAdded)
animation.addCallBackFunction('Floating Space Draw', thisObject.floatingSpace.draw, onFunctionAdded)
@@ -730,8 +731,12 @@ function newCanvas () {
}
if (containerBeingDragged !== undefined) {
containerBeingDragged.frame.position.x = containerBeingDragged.frame.position.x + displaceVector.x
containerBeingDragged.frame.position.y = containerBeingDragged.frame.position.y + displaceVector.y
if (containerBeingDragged.notDraggingOnX === false) {
containerBeingDragged.frame.position.x = containerBeingDragged.frame.position.x + displaceVector.x
}
if (containerBeingDragged.notDraggingOnY === false) {
containerBeingDragged.frame.position.y = containerBeingDragged.frame.position.y + displaceVector.y
}
}
}
+2
View File
@@ -8,6 +8,8 @@ function newContainer () {
eventHandler: undefined,
parentContainer: undefined,
isDraggeable: true,
notDraggingOnX: false,
notDraggingOnY: false,
isClickeable: false,
isWheelable: false,
detectMouseOver: false,
+14 -8
View File
@@ -6,6 +6,7 @@
let thisObject = {
container: undefined,
draw: draw,
physics: physics,
getContainer: getContainer, // returns the inner most container that holds the point received by parameter.
createNewControl: createNewControl,
destroyControl: destroyControl,
@@ -18,6 +19,7 @@
thisObject.container.initialize(MODULE_NAME)
thisObject.container.isClickeable = false
thisObject.container.isDraggeable = true
thisObject.container.notDraggingOnX = true
controlsMap = new Map()
resize()
@@ -44,6 +46,18 @@
// canvas.strategySpace.investmentPlanWorkspace.showUp()
}
function resize () {
thisObject.container.frame.position.x = 0
thisObject.container.frame.position.y = viewPort.visibleArea.bottomLeft.y
thisObject.container.frame.width = browserCanvas.width
thisObject.container.frame.height = BOTTOM_SPACE_HEIGHT
}
function physics () {
}
function createNewControl (pType, pDrawFunction, pOwner) {
let control
@@ -108,14 +122,6 @@
}
}
function resize () {
thisObject.container.frame.position.x = 0
thisObject.container.frame.position.y = viewPort.visibleArea.bottomLeft.y
thisObject.container.frame.width = browserCanvas.width
thisObject.container.frame.height = BOTTOM_SPACE_HEIGHT
}
function getContainer (point) {
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
return thisObject.container