Adjusting gravity

This commit is contained in:
Luis Fernando Molina committed 2019-05-09 15:51:56 +02:00
1 parent 6eb8e0a8b7
commit c8df19f24d
2 files changed
+55 -6

No files matched your search

+15 -4
View File
@@ -43,7 +43,7 @@ function newStrategyPartConstructor () {
switch (payload.node.type) {
case 'Investment Plan': {
level_1()
level_0()
break
}
case 'Strategy': {
@@ -92,10 +92,21 @@ function newStrategyPartConstructor () {
}
}
function level_1 () {
floatingObject.friction = FRICTION
function level_0 () {
floatingObject.friction = 0.93
floatingObject.initializeMass(100)
floatingObject.initializeMass(500)
floatingObject.initializeRadius(45)
floatingObject.initializeImageSize(80)
floatingObject.initializeFontSize(10)
floatingObject.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 1)'
}
function level_1 () {
floatingObject.friction = 0.94
floatingObject.initializeMass(250)
floatingObject.initializeRadius(45)
floatingObject.initializeImageSize(80)
floatingObject.initializeFontSize(10)
+40 -2
View File
@@ -7,6 +7,7 @@ function newStrategyPartTitle () {
logger.fileName = MODULE_NAME
let thisObject = {
allwaysVisible: undefined,
editMode: undefined,
container: undefined,
payload: undefined,
@@ -44,6 +45,43 @@ function newStrategyPartTitle () {
function initialize (payload) {
thisObject.payload = payload
switch (payload.node.type) {
case 'Investment Plan': {
break
}
case 'Strategy': {
thisObject.allwaysVisible = true
break
}
case 'Strategy Entry Event': {
break
}
case 'Strategy Exit Event': {
break
}
case 'Trade Entry Event': {
break
}
case 'Stop': {
break
}
case 'Take Profit': {
break
}
case 'Phase': {
break
}
case 'Situation': {
break
}
case 'Condition': {
break
}
default: {
if (ERROR_LOG === true) { logger.write('[ERROR] initialize -> Part Type not Recognized -> type = ' + payload.node.type) }
}
}
selfFocusEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onFocus', onFocus)
selfNotFocuskEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onNotFocus', onNotFocus)
selfMouseClickEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseClick', onMouseClick)
@@ -130,7 +168,7 @@ function newStrategyPartTitle () {
}
function draw () {
if (thisObject.isOnFocus === true) {
if (thisObject.isOnFocus === true || thisObject.allwaysVisible === true) {
if (thisObject.payload.uiObject.codeEditor !== undefined) {
if (thisObject.payload.uiObject.codeEditor.visible !== true) {
drawTitleBackground()
@@ -163,7 +201,7 @@ function newStrategyPartTitle () {
let fontSize = thisObject.payload.floatingObject.currentFontSize
let label
if (radius > 6 && thisObject.isOnFocus === true) {
if (radius > 6 && (thisObject.isOnFocus === true || thisObject.allwaysVisible === true)) {
browserCanvasContext.strokeStyle = thisObject.payload.floatingObject.labelStrokeStyle
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY