Bug Fixes & panels hidding

This commit is contained in:
Luis Fernando Molina committed 2020-02-28 19:07:43 +01:00
1 parent 64453dfb3a
commit 05bd771953
4 files changed
+40 -21

No files matched your search

+10 -6
View File
@@ -550,11 +550,15 @@ function newCanvas () {
container = thisObject.panelsSpace.getContainer(point)
if (container !== undefined && container.isDraggeable === true && event.shiftKey === false) {
containerBeingDragged = container
containerDragStarted = true
containerBeingDragged.eventHandler.raiseEvent('onDragStarted', point)
return
if (container !== undefined && event.shiftKey === false) {
if (container.isDraggeable === true) {
containerBeingDragged = container
containerDragStarted = true
containerBeingDragged.eventHandler.raiseEvent('onDragStarted', point)
return
} else {
return
}
}
if (container !== undefined && container.isClickeable === true) {
@@ -783,7 +787,7 @@ function newCanvas () {
/* We check if the mouse is over a panel/ */
if (thisObject.panelsSpace !== undefined) {
container = thisObject.panelsSpace.getContainer(point)
container = thisObject.panelsSpace.getContainer(point, GET_CONTAINER_PURPOSE.MOUSE_OVER)
if (container !== undefined && container.detectMouseOver === true) {
containerFound()
+26 -3
View File
@@ -18,8 +18,11 @@ function newLayersPanel () {
thisObject.container.initialize()
thisObject.container.isDraggeable = true
thisObject.container.isWheelable = true
thisObject.container.detectMouseOver = true
let isInitialized = false
let isMouseOver = false
let mouseOverCounter = 0
let layersMap = new Map()
let visibleLayers = []
@@ -36,10 +39,12 @@ function newLayersPanel () {
let posiblePanelHeight = (layerHeight + LAYER_SEPARATION) * posibleVisibleLayers + headerHeight + footerHeight
let onMouseWheelEventSuscriptionId
let onMouseOverEventSuscriptionId
return thisObject
function finalize () {
thisObject.container.eventHandler.stopListening(onMouseWheelEventSuscriptionId)
thisObject.container.eventHandler.stopListening(onMouseOverEventSuscriptionId)
thisObject.panelTabButton.finalize()
thisObject.panelTabButton = undefined
@@ -74,6 +79,7 @@ function newLayersPanel () {
thisObject.panelTabButton.initialize()
onMouseWheelEventSuscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseWheel', onMouseWheel)
onMouseOverEventSuscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseOver', onMouseOver)
readObjectState()
@@ -166,6 +172,11 @@ function newLayersPanel () {
}
}
function onMouseOver (event) {
isMouseOver = true
mouseOverCounter = 150
}
function onMouseWheel (event) {
delta = event.wheelDelta
if (delta > 0) {
@@ -239,7 +250,7 @@ function newLayersPanel () {
thisObject.container.eventHandler.raiseEvent('Layer Status Changed', layer)
}
function getContainer (point) {
function getContainer (point, purpose) {
if (isInitialized === false || thisObject.visible === false || thisObject.isHidden === true) { return }
let container
@@ -261,7 +272,9 @@ function newLayersPanel () {
checkPoint = thisObject.fitFunction(checkPoint)
if (point.x === checkPoint.x && point.y === checkPoint.y) {
return container
if (container.isForThisPurpose(purpose)) {
return container
}
}
}
}
@@ -291,8 +304,18 @@ function newLayersPanel () {
readObjectState()
}
function mouseOverPhysics () {
mouseOverCounter--
if (mouseOverCounter < 0) {
mouseOverCounter = 0
isMouseOver = false
}
}
function physics () {
if (isInitialized === false) { return }
mouseOverPhysics()
thisObject.panelTabButton.physics()
saveFrame(thisObject.payload, thisObject.container.frame)
syncWithConfigPhysics()
@@ -369,7 +392,7 @@ function newLayersPanel () {
}
function draw () {
if (isInitialized === false || thisObject.visible === false || thisObject.isHidden === true) { return }
if (isInitialized === false || thisObject.visible === false || thisObject.isHidden === true || isMouseOver === false) { return }
// thisObject.container.frame.draw(false, false, false, thisObject.fitFunction)
+2 -10
View File
@@ -19,6 +19,7 @@ function newPanelTabButton () {
thisObject.container.name = 'Panel Tab Button'
thisObject.container.initialize()
thisObject.container.isClickeable = true
thisObject.container.isDraggeable = false
thisObject.container.frame.containerName = 'Panel Tab Button'
/* Animation to hide the pannel */
@@ -127,19 +128,10 @@ function newPanelTabButton () {
drawButton()
}
function getContainer (point) {
function getContainer (point, purpose) {
let container
/* First we check if thisObject point is inside thisObject space. */
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
/* Now we see which is the inner most container that has it */
return thisObject.container
} else {
/* This point does not belong to thisObject space. */
return undefined
}
}
+2 -2
View File
@@ -326,7 +326,7 @@ function newPanelsSpace () {
}
}
function getContainer (point) {
function getContainer (point, purpose) {
if (thisObject.visible !== true) { return }
let container
@@ -339,7 +339,7 @@ function newPanelsSpace () {
let owner = canvas.chartingSpace.inViewport.get(panel.owner)
if (owner !== undefined) {
if (panel.isVisible === true && panel.isHidden === false) {
container = panel.getContainer(point)
container = panel.getContainer(point, purpose)
}
}
if (container !== undefined) {