HUGE BUG fixed, duplicating the creation of UI Objects

This commit is contained in:
Luis Fernando Molina committed 2019-12-24 17:17:56 +01:00
1 parent b6ca74d433
commit a595d3f0a8
10 files changed
+150 -895

No files matched your search

@@ -30,13 +30,17 @@ function newNodeCloning () {
/* Children Nodes */
if (nodeDefinition.properties !== undefined) {
let previousPropertyName // Since there are cases where there are many properties with the same name,because they can hold nodes of different types but only one at the time, we have to avoind counting each property of those as individual children.
for (let i = 0; i < nodeDefinition.properties.length; i++) {
let property = nodeDefinition.properties[i]
switch (property.type) {
case 'node': {
if (node[property.name] !== undefined) {
object[property.name] = cloneNode(node[property.name])
if (property.name !== previousPropertyName) {
if (node[property.name] !== undefined) {
object[property.name] = cloneNode(node[property.name])
}
previousPropertyName = property.name
}
break
}
@@ -79,13 +83,17 @@ function newNodeCloning () {
/* Children Nodes */
if (nodeDefinition.properties !== undefined) {
let previousPropertyName // Since there are cases where there are many properties with the same name,because they can hold nodes of different types but only one at the time, we have to avoind counting each property of those as individual children.
for (let i = 0; i < nodeDefinition.properties.length; i++) {
let property = nodeDefinition.properties[i]
switch (property.type) {
case 'node': {
if (node[property.name] !== undefined) {
object[property.name] = redirectReferenceParents(node[property.name])
if (property.name !== previousPropertyName) {
if (node[property.name] !== undefined) {
object[property.name] = redirectReferenceParents(node[property.name])
}
previousPropertyName = property.name
}
break
}
@@ -28,13 +28,17 @@ function newNodeDeleter () {
if (nodeDefinition !== undefined) {
/* Remove all of its own children nodes. */
if (nodeDefinition.properties !== undefined) {
let previousPropertyName // Since there are cases where there are many properties with the same name,because they can hold nodes of different types but only one at the time, we have to avoind counting each property of those as individual children.
for (let i = 0; i < nodeDefinition.properties.length; i++) {
let property = nodeDefinition.properties[i]
switch (property.type) {
case 'node': {
if (node[property.name] !== undefined) {
deleteUIObject(node[property.name], rootNodes)
if (property.name !== previousPropertyName) {
if (node[property.name] !== undefined) {
deleteUIObject(node[property.name], rootNodes)
}
previousPropertyName = property.name
}
}
break
@@ -17,17 +17,21 @@ function newOnFocus () {
/* Then we check all of its own children nodes. */
if (node.payload.floatingObject.isCollapsed !== true) {
if (nodeDefinition.properties !== undefined) {
let previousPropertyName // Since there are cases where there are many properties with the same name,because they can hold nodes of different types but only one at the time, we have to avoind counting each property of those as individual children.
for (let i = 0; i < nodeDefinition.properties.length; i++) {
let property = nodeDefinition.properties[i]
switch (property.type) {
case 'node': {
if (node[property.name] !== undefined) {
let child
child = getNodeThatIsOnFocus(node[property.name])
if (child !== undefined) {
return child
if (property.name !== previousPropertyName) {
if (node[property.name] !== undefined) {
let child
child = getNodeThatIsOnFocus(node[property.name])
if (child !== undefined) {
return child
}
}
previousPropertyName = property.name
}
}
break
@@ -25,19 +25,23 @@ function newProtocolNode () {
/* Children Nodes */
if (nodeDefinition.properties !== undefined) {
let previousPropertyName // Since there are cases where there are many properties with the same name,because they can hold nodes of different types but only one at the time, we have to avoind counting each property of those as individual children.
for (let i = 0; i < nodeDefinition.properties.length; i++) {
let property = nodeDefinition.properties[i]
switch (property.type) {
case 'node': {
if (node[property.name] !== undefined) {
if (lightingPath === undefined) {
object[property.name] = getProtocolNode(node[property.name], removePersonalData, parseCode, includeIds, includeReferencesInSavedPayload, includePayload)
} else {
let newLightingPath = getNewLightingPath(lightingPath, node.type, property.childType)
if (newLightingPath !== undefined) {
object[property.name] = getProtocolNode(node[property.name], removePersonalData, parseCode, includeIds, includePayload, includeReferencesInSavedPayload, newLightingPath)
if (property.name !== previousPropertyName) {
if (lightingPath === undefined) {
object[property.name] = getProtocolNode(node[property.name], removePersonalData, parseCode, includeIds, includeReferencesInSavedPayload, includePayload)
} else {
let newLightingPath = getNewLightingPath(lightingPath, node.type, property.childType)
if (newLightingPath !== undefined) {
object[property.name] = getProtocolNode(node[property.name], removePersonalData, parseCode, includeIds, includePayload, includeReferencesInSavedPayload, newLightingPath)
}
}
previousPropertyName = property.name
}
}
break
@@ -16,17 +16,21 @@ function newShortcutKeys () {
/* Check all of its own children nodes. */
if (node.payload.floatingObject.isCollapsed !== true) {
if (nodeDefinition.properties !== undefined) {
let previousPropertyName // Since there are cases where there are many properties with the same name,because they can hold nodes of different types but only one at the time, we have to avoind counting each property of those as individual children.
for (let i = 0; i < nodeDefinition.properties.length; i++) {
let property = nodeDefinition.properties[i]
switch (property.type) {
case 'node': {
if (node[property.name] !== undefined) {
let child
child = getNodeByShortcutKey(node[property.name], searchingKey)
if (child !== undefined) {
return child
if (property.name !== previousPropertyName) {
if (node[property.name] !== undefined) {
let child
child = getNodeByShortcutKey(node[property.name], searchingKey)
if (child !== undefined) {
return child
}
}
previousPropertyName = property.name
}
}
break
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -113,7 +113,7 @@ function newWorkspace () {
if (thisObject.enabled !== true) { return }
let textToSave = stringifyWorkspace()
window.localStorage.setItem(CANVAS_APP_NAME + '.' + 'Workspace', textToSave)
// window.localStorage.setItem(CANVAS_APP_NAME + '.' + 'Workspace', textToSave)
if (workingAtTask > 0) {
circularProgressBar.physics()
+6 -3
View File
@@ -188,8 +188,12 @@ function newFloatingObject () {
if (thisObject.frozenManually !== false) { return }
if (thisObject.payload === undefined) { return }
let parent = thisObject.payload.chainParent
if (parent !== undefined && parent.payload !== undefined) {
thisObject.isFrozen = parent.payload.floatingObject.isFrozen
if (parent !== undefined) {
if (parent.payload !== undefined) {
if (parent.payload.floatingObject !== undefined) {
thisObject.isFrozen = parent.payload.floatingObject.isFrozen
}
}
}
}
@@ -479,4 +483,3 @@ function newFloatingObject () {
function updateRadius () {
}
}
+4 -2
View File
@@ -227,8 +227,10 @@ function newUiObject () {
thisObject.payload.targetPosition.x = thisObject.payload.position.x,
thisObject.payload.targetPosition.y = thisObject.payload.position.y
} else {
thisObject.payload.targetPosition.x = thisObject.payload.chainParent.payload.position.x
thisObject.payload.targetPosition.y = thisObject.payload.chainParent.payload.position.y
if (thisObject.payload.chainParent.payload.position !== undefined) {
thisObject.payload.targetPosition.x = thisObject.payload.chainParent.payload.position.x
thisObject.payload.targetPosition.y = thisObject.payload.chainParent.payload.position.y
}
}
if (thisObject.circularProgressBar !== undefined) {
+13 -4
View File
@@ -31,14 +31,23 @@ function newUiObjectConstructor () {
floatingObject.initialize('UI Object', payload)
payload.floatingObject = floatingObject
if (payload.node.savedPayload !== undefined) {
/*
When this object is created based on a backup, share or clone, we will have a savedPayload that we will use to set the initial properties.
If it is a new object being created out of the user interface, we jusst continue with the construction process.
*/
if (userAddingNew === false && payload.node.type !== 'Workspace') {
let position = {
x: 0,
y: 0
}
position = {
x: payload.node.savedPayload.position.x,
y: payload.node.savedPayload.position.y
}
if (position.x === null) { position.x = spawnPosition.x }
if (position.y === null) { position.y = spawnPosition.y }
// if (position.x === undefined) { position.x = spawnPosition.x }
// if (position.y === undefined) { position.y = spawnPosition.y }
floatingObject.setPosition(position)
payload.node.savedPayload.position = undefined
@@ -56,8 +65,8 @@ function newUiObjectConstructor () {
}
}
/* For brand new objects being created directly by the user, we will make them inherit some properties from their parents. */
if (userAddingNew === true) {
/* For brand new objects being created directly by the user, we will make them inherit some properties from their parents. */
if (payload.parentNode.payload.floatingObject.isTensed === true) {
floatingObject.tensionToggle()
}