When not worspace is disabled no calculate button

This commit is contained in:
Luis Fernando Molina committed 2019-07-02 16:55:54 +02:00
1 parent 66a8e06912
commit 2c752c9a7a
3 files changed
+27 -25

No files matched your search

+22 -20
View File
@@ -47,20 +47,18 @@
thisObject.container.frame.position.x = 0
let INITIAL_POSITION
const accessToken = window.localStorage.getItem(LOGGED_IN_ACCESS_TOKEN_LOCAL_STORAGE_KEY)
if (accessToken !== null) {
INITIAL_POSITION = 55
if (canvas.strategySpace.workspace.enabled === true) {
let localStorage = window.localStorage.getItem(MODULE_NAME)
if (localStorage !== null) {
storage = JSON.parse(localStorage)
thisObject.container.frame.position.y = storage.spacePosition
} else {
INITIAL_POSITION = 55
thisObject.container.frame.position.y = browserCanvas.height * INITIAL_POSITION / 100 - COCKPIT_SPACE_HEIGHT
}
} else {
INITIAL_POSITION = 100
}
thisObject.container.frame.position.y = browserCanvas.height * INITIAL_POSITION / 100 - COCKPIT_SPACE_HEIGHT
let localStorage = window.localStorage.getItem(MODULE_NAME)
if (localStorage !== null) {
storage = JSON.parse(localStorage)
thisObject.container.frame.position.y = storage.spacePosition
thisObject.container.frame.position.y = browserCanvas.height * INITIAL_POSITION / 100 - COCKPIT_SPACE_HEIGHT
}
canvasBrowserResizedEventSubscriptionId = window.canvasApp.eventHandler.listenToEvent('Browser Resized', resize)
@@ -101,7 +99,9 @@
}
function childrenPhysics () {
thisObject.restartSimulation.physics()
if (canvas.strategySpace.workspace.enabled === true) {
thisObject.restartSimulation.physics()
}
thisObject.fullscreen.physics()
}
function thisObjectPhysics () {
@@ -109,8 +109,7 @@
thisObject.status = 'MIDDLE'
let user = window.localStorage.getItem(LOGGED_IN_USER_LOCAL_STORAGE_KEY)
if (user !== null) { // Only if user is logged in
if (canvas.strategySpace.workspace.enabled === true) {
thisObject.container.isDraggeable = true
} else {
thisObject.container.isDraggeable = false
@@ -143,8 +142,10 @@
function getContainer (point) {
let container
container = thisObject.restartSimulation.getContainer(point)
if (container !== undefined) { return container }
if (canvas.strategySpace.workspace.enabled === true) {
container = thisObject.restartSimulation.getContainer(point)
if (container !== undefined) { return container }
}
container = thisObject.fullscreen.getContainer(point)
if (container !== undefined) { return container }
@@ -162,7 +163,9 @@
drawBackground()
thisObject.assetBalances.draw()
thisObject.restartSimulation.draw()
if (canvas.strategySpace.workspace.enabled === true) {
thisObject.restartSimulation.draw()
}
thisObject.fullscreen.draw()
}
@@ -196,8 +199,7 @@
browserCanvasContext.closePath()
browserCanvasContext.fill()
let user = window.localStorage.getItem(LOGGED_IN_USER_LOCAL_STORAGE_KEY)
if (user !== null) { // Only if user is logged in
if (canvas.strategySpace.workspace.enabled === true) {
arrow()
}
}
+1 -1
View File
@@ -112,7 +112,7 @@ function newStrategizerGateway () {
return
}
let idAtStrategizer = window.localStorage.getItem(MODULE_NAME)
let idAtStrategizer = window.localStorage.getItem(CANVAS_APP_NAME + '.' + MODULE_NAME + '.' + user.alias)
if (idAtStrategizer === undefined || idAtStrategizer === null) {
logger.write('[ERROR] saveToStrategyzer -> Can not save when idAtStrategizer is null or undefined.')
return
+4 -4
View File
@@ -5,6 +5,7 @@ function newWorkspace () {
let thisObject = {
tradingSystem: undefined,
container: undefined,
enabled: false,
onMenuItemClick: onMenuItemClick,
getProtocolTradingSystem: getProtocolTradingSystem,
physics: physics,
@@ -41,7 +42,6 @@ function newWorkspace () {
functionLibraryProtocolNode = newProtocolNode()
functionLibraryWorkspaceNodes = newStringifyNode()
let isInitialized = false
return thisObject
function finalize () {
@@ -73,7 +73,7 @@ function newWorkspace () {
let rootNode = workspaceNode.rootNodes[i]
functionLibraryPartsFromNodes.createPartFromNode(rootNode, undefined, undefined)
}
isInitialized = true
thisObject.enabled = true
}
}
@@ -84,7 +84,7 @@ function newWorkspace () {
workspaceNode.rootNodes.push(thisObject.tradingSystem)
functionLibraryPartsFromNodes.createPartFromNode(thisObject.tradingSystem, undefined, undefined)
thisObject.tradingSystem.payload.uiObject.setRunningStatus()
isInitialized = true
thisObject.enabled = true
}
}
@@ -101,7 +101,7 @@ function newWorkspace () {
}
function physics () {
if (isInitialized !== true) { return }
if (thisObject.enabled !== true) { return }
/* Here we will save all the workspace related objects into the local storage */
let user = window.localStorage.getItem(LOGGED_IN_USER_LOCAL_STORAGE_KEY)
if (user === null) {