Side Tabs depending on elements of the workspace working

This commit is contained in:
Luis Fernando Molina committed 2021-07-14 21:04:07 +02:00
1 parent 210f72effd
commit a480b1595e
4 files changed
+100 -34

No files matched your search

@@ -413,6 +413,8 @@ function newWorkspace() {
UI.projects.foundations.spaces.floatingSpace.inMapMode = false
thisObject.isInitialized = true
UI.projects.governance.spaces.reportsSpace.reset()
await UI.projects.education.spaces.docsSpace.reset()
await UI.projects.education.spaces.tutorialSpace.reset()
@@ -15,7 +15,8 @@ function newSidePanelTab() {
physics: physics,
draw: draw,
getContainer: getContainer,
initialize: initialize
initialize: initialize,
finalize: finalize
}
const TAB_WIDTH = 60
@@ -26,6 +27,7 @@ function newSidePanelTab() {
let animation = 'none'
let ORIGINAL_PARENT_POSITON
let xOffset = 0
let onMouseClickEventSubscriptionId
thisObject.container = newContainer()
thisObject.container.name = MODULE_NAME
@@ -35,6 +37,11 @@ function newSidePanelTab() {
return thisObject
function finalize() {
thisObject.pointerDirection = undefined
thisObject.container.eventHandler.stopListening(onMouseClickEventSubscriptionId)
}
function initialize(screenside, index) {
thisObject.screenside = screenside
if (index !== undefined) {
@@ -54,7 +61,7 @@ function newSidePanelTab() {
thisObject.container.frame.width = TAB_WIDTH
thisObject.container.frame.height = TAB_HEIGHT
thisObject.container.eventHandler.listenToEvent('onMouseClick', onMouseClick)
onMouseClickEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseClick', onMouseClick)
resize()
isInitialized = true
}
@@ -126,7 +133,7 @@ function newSidePanelTab() {
}
function positionPhysics() {
thisObject.container.frame.position.y = browserCanvas.height / 2 - TAB_HEIGHT / 2 + thisObject.index * (TAB_HEIGHT - 1)
thisObject.container.frame.position.y = browserCanvas.height / 2 - TAB_HEIGHT / 2 + (thisObject.index - 1) * TAB_HEIGHT
}
function draw() {
@@ -6,7 +6,8 @@ function newFoundationsSideSpace() {
rightTabs: undefined,
physics: physics,
draw: draw,
createSidePanelTab, createSidePanelTab,
createSidePanelTab: createSidePanelTab,
deleteSidePanelTab: deleteSidePanelTab,
getContainer: getContainer,
initialize: initialize,
finalize: finalize
@@ -60,28 +61,68 @@ function newFoundationsSideSpace() {
return sidePanel
}
function deleteSidePanelTab(porject, iconName, label, side) {
let key = porject + '-' + iconName + '-' + label + '-' + side
if (existingTabs.get(key) !== undefined) {
let sidePanelTab = existingTabs.get(key)
switch (side) {
case 'left': {
thisObject.leftTabs.splice(sidePanelTab.index - 1, 1)
break
}
case 'right': {
thisObject.rightTabs.splice(sidePanelTab.index - 1, 1)
break
}
}
sidePanelTab.finalize()
existingTabs.delete(key)
/*
Reindex Remaining SidTabs
*/
let indexLeft = 1
let indexRight = 1
existingTabs.forEach(reindex)
function reindex(sideTab, key, map) {
switch (sideTab.screenside) {
case 'left': {
sideTab.index = indexLeft
indexLeft++
break
}
case 'right': {
sideTab.index = indexRight
indexRight++
break
}
}
}
}
}
function getContainer(point, purpose) {
}
function physics() {
for (let i = 0; i < thisObject.leftTabs.length; i++) {
let sideTab = thisObject.leftTabs[i]
sideTab.physics()
}
for (let i = 0; i < thisObject.rightTabs.length; i++) {
let sideTab = thisObject.rightTabs[i]
existingTabs.forEach(sideTabPhysics)
function sideTabPhysics(sideTab, key, map) {
sideTab.physics()
}
}
function draw() {
for (let i = 0; i < thisObject.leftTabs.length; i++) {
let sideTab = thisObject.leftTabs[i]
sideTab.draw()
}
for (let i = 0; i < thisObject.rightTabs.length; i++) {
let sideTab = thisObject.rightTabs[i]
existingTabs.forEach(sideTabDraw)
function sideTabDraw(sideTab, key, map) {
sideTab.draw()
}
}