Showing referenced nodes

This commit is contained in:
Luis Fernando Molina committed 2020-04-06 12:08:05 +02:00
1 parent 02dce15cf5
commit 157b9b0238
5 files changed
+61 -8

No files matched your search

@@ -24,6 +24,11 @@ function newNodeDeleter () {
}
function deleteUIObject (node, rootNodes) {
/* First we restore the reference parent to its default state */
if (node.payload.referenceParent.payload !== undefined && node.payload.referenceParent.payload.uiObject !== undefined) {
node.payload.referenceParent.payload.uiObject.isShowing = false
}
let nodeDefinition = APP_SCHEMA_MAP.get(node.type)
if (nodeDefinition !== undefined) {
/* Remove all of its own children nodes. */
@@ -19,6 +19,10 @@ function newReferenceAttachDetach () {
}
function completeDetachment (node) {
if (node.payload.referenceParent.payload !== undefined && node.payload.referenceParent.payload.uiObject !== undefined) {
node.payload.referenceParent.payload.uiObject.isShowing = false
}
node.payload.referenceParent = undefined
if (node.savedPayload !== undefined) {
node.savedPayload.referenceParent = undefined
+18 -6
View File
@@ -560,20 +560,32 @@ function newFloatingObject () {
}
function drawBackground () {
if (canvas.floatingSpace.isItFar(thisObject.payload)) { return }
if ((thisObject.isCollapsed === true && thisObject.collapsedManually === false) || thisObject.isParentCollapsed === true) { return }
if (canvas.floatingSpace.isItFar(thisObject.payload) && thisObject.payload.uiObject.isShowing === false) { return }
if ((thisObject.isCollapsed === true && thisObject.collapsedManually === false) || thisObject.isParentCollapsed === true) {
if (thisObject.payload.uiObject.isShowing !== true) {
return
}
}
thisObject.payload.uiObject.drawBackground()
}
function drawMiddleground () {
if (canvas.floatingSpace.isItFar(thisObject.payload)) { return }
if ((thisObject.isCollapsed === true && thisObject.collapsedManually === false) || thisObject.isParentCollapsed === true) { return }
if (canvas.floatingSpace.isItFar(thisObject.payload) && thisObject.payload.uiObject.isShowing === false) { return }
if ((thisObject.isCollapsed === true && thisObject.collapsedManually === false) || thisObject.isParentCollapsed === true) {
if (thisObject.payload.uiObject.isShowing !== true) {
return
}
}
thisObject.payload.uiObject.drawMiddleground()
}
function drawForeground () {
if (canvas.floatingSpace.isItFar(thisObject.payload)) { return }
if ((thisObject.isCollapsed === true && thisObject.collapsedManually === false) || thisObject.isParentCollapsed === true) { return }
if (canvas.floatingSpace.isItFar(thisObject.payload) && thisObject.payload.uiObject.isShowing === false) { return }
if ((thisObject.isCollapsed === true && thisObject.collapsedManually === false) || thisObject.isParentCollapsed === true) {
if (thisObject.payload.uiObject.isShowing !== true) {
return
}
}
thisObject.payload.uiObject.drawForeground()
}
+32 -2
View File
@@ -23,6 +23,7 @@ function newUiObject () {
isExecuting: undefined,
isRunning: undefined,
shortcutKey: undefined,
isShowing: undefined,
run: run,
stop: stop,
heartBeat: heartBeat,
@@ -186,6 +187,7 @@ function newUiObject () {
thisObject.uiObjectTitle = newUiObjectTitle()
thisObject.uiObjectTitle.isVisibleFunction = thisObject.isVisibleFunction
thisObject.uiObjectTitle.container.connectToParent(thisObject.container, false, false, true, true, false, false, true, true)
thisObject.uiObjectTitle.fitFunction = thisObject.fitFunction
thisObject.uiObjectTitle.initialize(thisObject.payload)
/* Load UI Object Image */
@@ -364,8 +366,10 @@ function newUiObject () {
let totalRunning = 0
for (let j = 0; j < children.length; j++) {
let child = children[j]
if (child.payload.uiObject.isRunning === true) {
totalRunning++
if (child.payload !== undefined) {
if (child.payload.uiObject.isRunning === true) {
totalRunning++
}
}
}
if (totalRunning > 0) {
@@ -870,6 +874,10 @@ function newUiObject () {
function onFocus () {
thisObject.isOnFocus = true
if (thisObject.payload !== undefined && thisObject.isOnFocus === true && thisObject.payload.referenceParent !== undefined) {
thisObject.payload.referenceParent.payload.uiObject.isShowing = true
}
}
function onNotFocus () {
@@ -886,6 +894,10 @@ function newUiObject () {
if (thisObject.formulaEditor !== undefined) {
thisObject.formulaEditor.deactivate()
}
if (thisObject.payload !== undefined && thisObject.isOnFocus === false && thisObject.payload.referenceParent !== undefined) {
thisObject.payload.referenceParent.payload.uiObject.isShowing = false
}
}
function onDisplace (event) {
@@ -1132,6 +1144,10 @@ function newUiObject () {
targetPoint = canvas.floatingSpace.container.frame.frameThisPoint(targetPoint)
position = thisObject.container.frame.frameThisPoint(position)
if (thisObject.isOnFocus === true) {
targetPoint = thisObject.fitFunction(targetPoint)
}
if (canvas.floatingSpace.inMapMode === true) {
position = canvas.floatingSpace.transformPointToMap(position)
targetPoint = canvas.floatingSpace.transformPointToMap(targetPoint)
@@ -1268,6 +1284,9 @@ function newUiObject () {
function drawValue () {
if (hasValue === false) { return }
if (canvas.floatingSpace.inMapMode === true) { return }
if (thisObject.payload === undefined) { return }
if ((thisObject.payload.floatingObject.isCollapsed === true && thisObject.payload.floatingObject.collapsedManually === false) || thisObject.payload.floatingObject.isParentCollapsed === true) { return }
// if (currentValue === undefined || currentValue === '') { return }
/* Text Follows */
@@ -1322,6 +1341,8 @@ function newUiObject () {
function drawPercentage () {
if (hasPercentage === false) { return }
if (canvas.floatingSpace.inMapMode === true) { return }
if (thisObject.payload === undefined) { return }
if ((thisObject.payload.floatingObject.isCollapsed === true && thisObject.payload.floatingObject.collapsedManually === false) || thisObject.payload.floatingObject.isParentCollapsed === true) { return }
let position = {
x: 0,
@@ -1475,6 +1496,10 @@ function newUiObject () {
position = thisObject.container.frame.frameThisPoint(position)
if (thisObject.isShowing === true) {
position = thisObject.fitFunction(position)
}
if (canvas.floatingSpace.inMapMode === true) {
position = canvas.floatingSpace.transformPointToMap(position)
}
@@ -1704,6 +1729,11 @@ function newUiObject () {
}
}
}
if (thisObject.isShowing === true) {
totalImageSize = 50
}
browserCanvasContext.drawImage(
icon, position.x - totalImageSize / 2,
position.y - totalImageSize / 2,
+2
View File
@@ -7,6 +7,7 @@ function newUiObjectTitle () {
logger.fileName = MODULE_NAME
let thisObject = {
fitFunction: undefined,
isVisibleFunction: undefined,
allwaysVisible: undefined,
editMode: undefined,
@@ -43,6 +44,7 @@ function newUiObjectTitle () {
thisObject.container = undefined
thisObject.payload = undefined
thisObject.isVisibleFunction = undefined
thisObject.fitFunction = undefined
}
function initialize (payload) {