Mouse Over Layers Panel to show them

This commit is contained in:
Luis Fernando Molina committed 2020-02-28 18:16:59 +01:00
1 parent 7bc6568f6f
commit 5b63ec7426
3 files changed
+29 -6

No files matched your search

+1 -1
View File
@@ -783,7 +783,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 = 100
}
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 -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) {