Loading Workspace Working

This commit is contained in:
Luis Fernando Molina committed 2020-05-14 16:34:08 +02:00
1 parent 599e48062f
commit 6fbb82272e
3 files changed
+36 -6

No files matched your search

+1 -1
View File
@@ -711,7 +711,7 @@ function newCanvas () {
let container
/* We check if the mouse is over an element of the Side Space / */
container = thisObject.sideSpace.getContainer(point)
container = thisObject.sideSpace.getContainer(point, GET_CONTAINER_PURPOSE.MOUSE_CLICK)
if (container !== undefined && container.isClickeable === true) {
container.eventHandler.raiseEvent('onMouseClick', point)
+30 -4
View File
@@ -11,6 +11,7 @@ function newWorkspace () {
enabled: false,
nodeChildren: undefined,
eventsServerClients: new Map(),
replaceWorkspaceByLoadingOne: replaceWorkspaceByLoadingOne,
save: saveWorkspace,
getHierarchyHeads: getHierarchyHeads,
getNodeThatIsOnFocus: getNodeThatIsOnFocus,
@@ -68,7 +69,7 @@ function newWorkspace () {
let workingAtTask = 0
let circularProgressBar = newBusyProgressBar()
circularProgressBar.fitFunction = canvas.floatingSpace.fitIntoVisibleArea
let droppedNode
let loadedWorkspaceNode
let sessionTimestamp = (new Date()).valueOf()
window.localStorage.setItem('Session Timestamp', sessionTimestamp)
@@ -238,8 +239,8 @@ function newWorkspace () {
workingAtTask++
break
case 3:
thisObject.workspaceNode = droppedNode
droppedNode = undefined
thisObject.workspaceNode = loadedWorkspaceNode
loadedWorkspaceNode = undefined
workingAtTask++
break
case 4:
@@ -339,6 +340,30 @@ function newWorkspace () {
return nodes
}
function replaceWorkspaceByLoadingOne (name) {
let blobService = newFileStorage()
blobService.getFileFromHost('LoadWorkspace' + '/' + name, onFileReceived, true)
function onFileReceived (err, text, response) {
if (err && err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
canvas.cockpitSpace.setStatus('Could not load the Workspace called "' + name + '". ', 500, canvas.cockpitSpace.statusTypes.WARNING)
return
}
loadedWorkspaceNode = JSON.parse(text)
canvas.cockpitSpace.toTop()
let position = {
x: browserCanvas.width / 2,
y: browserCanvas.height / 2
}
circularProgressBar.initialize(position)
circularProgressBar.visible = true
workingAtTask = 1
}
}
function spawn (nodeText, mousePointer) {
try {
let point = {
@@ -349,9 +374,10 @@ function newWorkspace () {
spawnPosition.x = point.x
spawnPosition.y = point.y
droppedNode = JSON.parse(nodeText)
let droppedNode = JSON.parse(nodeText)
if (droppedNode.type === 'Workspace') {
loadedWorkspaceNode = droppedNode
circularProgressBar.initialize(mousePointer)
circularProgressBar.visible = true
workingAtTask = 1
+5 -1
View File
@@ -19,6 +19,7 @@ function newListItem () {
thisObject.container.isDraggeable = false
thisObject.container.isWheelable = false
thisObject.container.detectMouseOver = true
thisObject.container.isClickeable = true
thisObject.container.frame.width = SIDE_PANEL_WIDTH * 0.75
thisObject.container.frame.height = SIDE_PANEL_WIDTH * 0.75
@@ -27,6 +28,7 @@ function newListItem () {
let onMouseOverEventSubscriptionId
let onMouseNotOverEventSubscriptionId
let onMouseClickEventSubscriptionId
let isMouseOver = false
return thisObject
@@ -34,6 +36,7 @@ function newListItem () {
function finalize () {
thisObject.container.eventHandler.stopListening(onMouseOverEventSubscriptionId)
thisObject.container.eventHandler.stopListening(onMouseNotOverEventSubscriptionId)
thisObject.container.eventHandler.stopListening(onMouseClickEventSubscriptionId)
thisObject.container.finalize()
thisObject.container = undefined
@@ -46,6 +49,7 @@ function newListItem () {
onMouseOverEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseOver', onMouseOver)
onMouseNotOverEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseNotOver', onMouseNotOver)
onMouseClickEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseClick', onMouseClick)
}
function getContainer (point) {
@@ -63,7 +67,7 @@ function newListItem () {
}
function onMouseClick (event) {
canvas.designSpace.workspace.replaceWorkspaceByLoadingOne(name)
}
function physics () {