positioning fixed

This commit is contained in:
Luis Fernando Molina committed 2020-12-18 14:36:56 +01:00
1 parent dba9051493
commit 25286d8668
2 files changed
+13 -7

No files matched your search

@@ -15,6 +15,7 @@ function newSuperalgosDocSpace() {
}
let isInitialized = false
const DOCS_SPACE_WIDTH = 900
thisObject.container = newContainer()
thisObject.container.name = MODULE_NAME
@@ -1135,8 +1136,10 @@ function newSuperalgosDocSpace() {
let node = await UI.projects.superalgos.spaces.designSpace.workspace.getNodeById(schemaDocument.key)
node.payload.floatingObject.unCollapseParent()
setTimeout(positionAtNode, 3000, node)
setTimeout(positionAtNode, 5000, node)
function positionAtNode(node) {
UI.projects.superalgos.spaces.floatingSpace.positionAtNode(node)
let xOffset = -DOCS_SPACE_WIDTH / 2
UI.projects.superalgos.spaces.floatingSpace.positionAtNode(node, xOffset)
}
}
@@ -2499,7 +2502,7 @@ function newSuperalgosDocSpace() {
}
function resize() {
thisObject.container.frame.width = 900
thisObject.container.frame.width = DOCS_SPACE_WIDTH
thisObject.container.frame.height = browserCanvas.height // - TOP_SPACE_HEIGHT
thisObject.container.frame.position.x = browserCanvas.width
thisObject.container.frame.position.y = 0 // TOP_SPACE_HEIGHT
@@ -92,7 +92,7 @@ function newSuperalgosFloatingSpace() {
distancePercentage: 100,
radiusPercentage: 100,
massPercentage: 100,
animationSteps: 2,
animationSteps: 2,
menuItem: {
widthPercentage: 100,
heightPercentage: 100,
@@ -360,12 +360,15 @@ function newSuperalgosFloatingSpace() {
return displaceVector
}
function positionAtNode(node) {
function positionAtNode(node, xOffset, yOffset) {
if (xOffset === undefined) { xOffset = 0 }
if (yOffset === undefined) { yOffset = 0 }
let position = thisObject.container.frame.frameThisPoint(node.payload.position)
let displaceVector = {
x: browserCanvas.width / 2 - position.x,
y: (COCKPIT_SPACE_POSITION + COCKPIT_SPACE_HEIGHT) + (browserCanvas.height - (COCKPIT_SPACE_POSITION + COCKPIT_SPACE_HEIGHT)) / 2 - position.y
x: browserCanvas.width / 2 - position.x + xOffset,
y: (COCKPIT_SPACE_POSITION + COCKPIT_SPACE_HEIGHT) + (browserCanvas.height - (COCKPIT_SPACE_POSITION + COCKPIT_SPACE_HEIGHT)) / 2 - position.y + yOffset
}
thisObject.container.displace(displaceVector)
@@ -519,7 +522,7 @@ function newSuperalgosFloatingSpace() {
}
if (configSettings.node.menuItem.heightPercentage !== undefined) {
thisObject.settings.node.menuItem.heightPercentage = configSettings.node.menuItem.heightPercentage
}
}
if (configSettings.node.menuItem.radiusPercentage !== undefined) {
thisObject.settings.node.menuItem.radiusPercentage = configSettings.node.menuItem.radiusPercentage
}