Protection agains null coordinates
This commit is contained in:
1 parent
3fc791c8f0
commit
dc57ec93da
3 files changed
+17
-1
No files matched your search
@@ -13,6 +13,10 @@ function newStrategyPartConstructor () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let floatingLayer
|
let floatingLayer
|
||||||
|
let spawnPosition = {
|
||||||
|
x: canvas.floatingSpace.container.frame.width / 2,
|
||||||
|
y: canvas.floatingSpace.container.frame.height / 2
|
||||||
|
}
|
||||||
|
|
||||||
return thisObject
|
return thisObject
|
||||||
|
|
||||||
@@ -39,6 +43,10 @@ function newStrategyPartConstructor () {
|
|||||||
x: payload.node.savedPayload.position.x,
|
x: payload.node.savedPayload.position.x,
|
||||||
y: payload.node.savedPayload.position.y
|
y: payload.node.savedPayload.position.y
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (position.x === null) { position.x = spawnPosition.x }
|
||||||
|
if (position.y === null) { position.y = spawnPosition.y }
|
||||||
|
|
||||||
floatingObject.setPosition(position)
|
floatingObject.setPosition(position)
|
||||||
payload.node.savedPayload.position = undefined
|
payload.node.savedPayload.position = undefined
|
||||||
if (payload.node.savedPayload.floatingObject.isPinned === true) {
|
if (payload.node.savedPayload.floatingObject.isPinned === true) {
|
||||||
|
|||||||
@@ -17,6 +17,11 @@ function newPartsFromNodes () {
|
|||||||
addCode: addCode
|
addCode: addCode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let spawnPosition = {
|
||||||
|
x: canvas.floatingSpace.container.frame.width / 2,
|
||||||
|
y: canvas.floatingSpace.container.frame.height / 2
|
||||||
|
}
|
||||||
|
|
||||||
return thisObject
|
return thisObject
|
||||||
|
|
||||||
function createPartFromNode (node, parentNode, chainParent) {
|
function createPartFromNode (node, parentNode, chainParent) {
|
||||||
@@ -539,6 +544,9 @@ function newPartsFromNodes () {
|
|||||||
y: node.savedPayload.targetPosition.y
|
y: node.savedPayload.targetPosition.y
|
||||||
}
|
}
|
||||||
node.savedPayload.targetPosition = undefined
|
node.savedPayload.targetPosition = undefined
|
||||||
|
|
||||||
|
if (payload.targetPosition.x === null) { payload.targetPosition.x = spawnPosition.x }
|
||||||
|
if (payload.targetPosition.y === null) { payload.targetPosition.y = spawnPosition.y }
|
||||||
} else {
|
} else {
|
||||||
if (chainParent === undefined) {
|
if (chainParent === undefined) {
|
||||||
payload.targetPosition = {
|
payload.targetPosition = {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ function newWorkspace () {
|
|||||||
thisObject.container.frame.width = 0
|
thisObject.container.frame.width = 0
|
||||||
thisObject.container.frame.height = 0
|
thisObject.container.frame.height = 0
|
||||||
|
|
||||||
spawnPosition = {
|
let spawnPosition = {
|
||||||
x: canvas.floatingSpace.container.frame.width / 2,
|
x: canvas.floatingSpace.container.frame.width / 2,
|
||||||
y: canvas.floatingSpace.container.frame.height / 2
|
y: canvas.floatingSpace.container.frame.height / 2
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user