BUG related to SPLICE fixed
This commit is contained in:
1 parent
7a571383ec
commit
b66ccc8182
3 files changed
+20
-18
No files matched your search
@@ -86,9 +86,9 @@ function newFloatingLayer () {
|
||||
creator keeps, is a handle to the object which it can use to retrieve the floating object when needed.
|
||||
*/
|
||||
|
||||
invisibleFloatingObjects.push(pFloatingObject)
|
||||
currentHandle++
|
||||
pFloatingObject.handle = currentHandle // Math.floor((Math.random() * 10000000) + 1);
|
||||
invisibleFloatingObjects.push(pFloatingObject)
|
||||
}
|
||||
|
||||
function killFloatingObject (pFloatingObjectHandle) {
|
||||
@@ -105,6 +105,7 @@ function newFloatingLayer () {
|
||||
invisibleFloatingObjects.splice(i, 1) // Delete item from array.
|
||||
|
||||
floatingObject.finalize()
|
||||
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -174,22 +175,19 @@ function newFloatingLayer () {
|
||||
drawVisibleObjects()
|
||||
|
||||
function drawVisibleObjects () {
|
||||
try {
|
||||
/* We draw all the visibleFloatingObjects. */
|
||||
|
||||
for (let i = 0; i < visibleFloatingObjects.length; i++) {
|
||||
let floatingObject = visibleFloatingObjects[i]
|
||||
floatingObject.drawBackground()
|
||||
}
|
||||
|
||||
for (let i = 0; i < visibleFloatingObjects.length; i++) {
|
||||
let floatingObject = visibleFloatingObjects[visibleFloatingObjects.length - i - 1]
|
||||
floatingObject.drawForeground()
|
||||
}
|
||||
|
||||
makeVisible()
|
||||
} catch (err) {
|
||||
for (let i = 0; i < visibleFloatingObjects.length; i++) {
|
||||
let floatingObject = visibleFloatingObjects[i]
|
||||
floatingObject.drawBackground()
|
||||
}
|
||||
|
||||
for (let i = 0; i < visibleFloatingObjects.length; i++) {
|
||||
let floatingObject = visibleFloatingObjects[visibleFloatingObjects.length - i - 1]
|
||||
floatingObject.drawForeground()
|
||||
}
|
||||
|
||||
makeVisible()
|
||||
}
|
||||
|
||||
function makeVisible () {
|
||||
|
||||
@@ -326,6 +326,11 @@ function newStrategyPart () {
|
||||
/* Here we do the trick of recalculation the position of the anchor by setting it to the position of its parent */
|
||||
let parentFloatingObject = floatingLayer.getFloatingObject(pFloatingObject.payload.parentNode.handle)
|
||||
|
||||
if (parentFloatingObject === undefined) {
|
||||
console.log(pFloatingObject)
|
||||
console.log('Now')
|
||||
}
|
||||
|
||||
pFloatingObject.payload.position.x = parentFloatingObject.container.frame.position.x
|
||||
pFloatingObject.payload.position.y = parentFloatingObject.container.frame.position.y
|
||||
|
||||
|
||||
@@ -222,8 +222,6 @@ function newStrategy () {
|
||||
}
|
||||
|
||||
function onMenuItemClick (payload, action) {
|
||||
console.log('onMenuItemClick ' + action)
|
||||
|
||||
switch (action) {
|
||||
case 'Open Settings':
|
||||
|
||||
@@ -269,7 +267,7 @@ function newStrategy () {
|
||||
}
|
||||
situation.conditions = []
|
||||
destroyPart(situation)
|
||||
payload.parentNode.situations.splice(j)
|
||||
payload.parentNode.situations.splice(j, 1)
|
||||
cleanNode(situation)
|
||||
return
|
||||
}
|
||||
@@ -282,7 +280,7 @@ function newStrategy () {
|
||||
let condition = payload.parentNode.conditions[i]
|
||||
if (condition.name === node.name) {
|
||||
destroyPart(node)
|
||||
payload.parentNode.conditions.splice(i)
|
||||
payload.parentNode.conditions.splice(i, 1)
|
||||
cleanNode(condition)
|
||||
return
|
||||
}
|
||||
@@ -300,6 +298,7 @@ function newStrategy () {
|
||||
node.payload.onMenuItemClick = undefined
|
||||
node.handle = undefined
|
||||
node.payload = undefined
|
||||
node.cleaned = true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user