From ae653d96b97c9bdeb17cc112f2298486fddaa080 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 27 Mar 2020 17:42:20 +0100 Subject: [PATCH] mac bug fixed --- CanvasApp/ChartingSpace/Viewport.js | 7 ++++++- CanvasApp/SystemEventHandler.js | 2 ++ .../plotters/Plotters-Trading-Simulation/Strategies.js | 6 ++++-- .../plotters/Plotters-Trading-Simulation/Trades.js | 4 ++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CanvasApp/ChartingSpace/Viewport.js b/CanvasApp/ChartingSpace/Viewport.js index d51df170b..4fd3c840f 100644 --- a/CanvasApp/ChartingSpace/Viewport.js +++ b/CanvasApp/ChartingSpace/Viewport.js @@ -201,6 +201,11 @@ function newViewport () { if ((event.ctrlKey === true || event.metaKey === true)) { return } let morePower = 1 let amount = event.delta + + if (IS_MAC) { + event.delta = event.delta * MAC_AMOUNT_FACTOR + } + if (event.buttons === 4) { morePower = 2 } // Mouse wheel pressed. /* We adjust the sensitivity for Mac Users */ @@ -220,7 +225,7 @@ function newViewport () { if (thisObject.zoomTargetLevel + amount * morePower < MIN_ZOOM_LEVEL) { return false } - thisObject.zoomTargetLevel = Math.round(Math.round((thisObject.zoomTargetLevel + amount * morePower) * MAC_AMOUNT_FACTOR) / MAC_AMOUNT_FACTOR) + thisObject.zoomTargetLevel = Math.round(thisObject.zoomTargetLevel + amount * morePower) ANIMATION_INCREMENT = Math.round(Math.abs(thisObject.zoomTargetLevel - thisObject.zoomLevel) / ANIMATION_STEPS * 100) / 100 diff --git a/CanvasApp/SystemEventHandler.js b/CanvasApp/SystemEventHandler.js index d8c4b520c..b200cc1b2 100644 --- a/CanvasApp/SystemEventHandler.js +++ b/CanvasApp/SystemEventHandler.js @@ -46,6 +46,8 @@ function newSystemEventHandler () { if (WEB_SOCKETS_CONNECTION.readyState === 1) { // 1 means connected and ready. WEB_SOCKETS_CONNECTION.send(JSON.stringify(command)) + } else { + console.log('WebSocket message could not be sent because the connection was not ready. Message = ' + JSON.stringify(command)) } } diff --git a/Legacy-Code/TradingEngines/plotters/Plotters-Trading-Simulation/Strategies.js b/Legacy-Code/TradingEngines/plotters/Plotters-Trading-Simulation/Strategies.js index 668496f87..a42d0b823 100644 --- a/Legacy-Code/TradingEngines/plotters/Plotters-Trading-Simulation/Strategies.js +++ b/Legacy-Code/TradingEngines/plotters/Plotters-Trading-Simulation/Strategies.js @@ -580,8 +580,10 @@ /* Situation Name */ let digit = record.begin.toFixed(0).substring(7,8) - let positionY = recordPoint3.y - (recordPoint3.y - recordPoint1.y) / 2 + (Number(digit) * 10 - 50) - printLabel(record.triggerOnSituation, recordPoint1.x + 5, positionY , '1', 12); + let positionY = recordPoint3.y - (recordPoint3.y - recordPoint1.y) / 2 + (Number(digit) * 10 - 50) + if (record.triggerOnSituation !== "My Situation") { + printLabel(record.triggerOnSituation, recordPoint1.x + 5, positionY, '1', 12); + } /* Draw the Sticks */ diff --git a/Legacy-Code/TradingEngines/plotters/Plotters-Trading-Simulation/Trades.js b/Legacy-Code/TradingEngines/plotters/Plotters-Trading-Simulation/Trades.js index 2d38c3233..1d99ee700 100644 --- a/Legacy-Code/TradingEngines/plotters/Plotters-Trading-Simulation/Trades.js +++ b/Legacy-Code/TradingEngines/plotters/Plotters-Trading-Simulation/Trades.js @@ -522,6 +522,10 @@ let line1 = ''; let line2 = ''; + if (line0 === 'My Situation') { + line0 = '' + } + if (record.status === 1) { switch (record.exitType) { case 1: {