Layers Managers only when at the center of the time machine

This commit is contained in:
Luis Fernando Molina committed 2020-02-29 11:49:21 +01:00
1 parent aef98c8a93
commit f6616d53ca
2 files changed
+20 -1

No files matched your search

+1 -1
View File
@@ -394,7 +394,7 @@ function newTimeMachine () {
}
function panelPhysics () {
if (thisObject.container.frame.isInViewPort() && canvas.chartingSpace.viewport.zoomTargetLevel > ZOOM_OUT_THRESHOLD_FOR_HIDDING_PANELS) {
if (thisObject.container.frame.isCenterInViewPort() && canvas.chartingSpace.viewport.zoomTargetLevel > ZOOM_OUT_THRESHOLD_FOR_HIDDING_PANELS) {
canvas.panelsSpace.unHide(thisObject.payload.node.id, 'Layers Panel')
canvas.panelsSpace.unHide(thisObject.payload.node.id, 'Plotter Panel')
} else {
+19
View File
@@ -21,6 +21,7 @@ function newFrame () {
isThisPointHere: isThisPointHere, // This function return true is the point received as parameter lives within this frame.
isThisScreenPointHere: isThisScreenPointHere,
isInViewPort: isInViewPort,
isCenterInViewPort: isCenterInViewPort,
initialize: initialize,
finalize: finalize
}
@@ -76,6 +77,24 @@ function newFrame () {
}
}
function isCenterInViewPort () {
/* This function is usefull to know if the object who has this frame is currently appearing at least in part at the canvas.chartingSpace.viewport */
point = {
x: thisObject.width / 2,
y: thisObject.height / 2
}
/* Now the transformations. */
point = transformThisPoint(point, thisObject.container)
if (point.x < canvas.chartingSpace.viewport.visibleArea.topRight.x && point.y < canvas.chartingSpace.viewport.visibleArea.bottomRight.y && point.x > canvas.chartingSpace.viewport.visibleArea.bottomLeft.x && point.y > canvas.chartingSpace.viewport.visibleArea.topLeft.y) {
return true
} else {
return false
}
}
function frameThisPoint (point) {
/* We need not to modify the point received, so me make a copy of it. */