BUG FIXED: rateScale appearing on Strategy Designer
This commit is contained in:
1 parent
2436ef766d
commit
fd1c9b8b8a
5 files changed
+20
-5
No files matched your search
@@ -18,6 +18,7 @@ function newTimeMachine () {
|
||||
container: undefined,
|
||||
timeScale: undefined,
|
||||
rateScale: undefined,
|
||||
fitFunction: undefined,
|
||||
charts: [],
|
||||
physics: physics,
|
||||
drawBackground: drawBackground,
|
||||
@@ -65,6 +66,7 @@ function newTimeMachine () {
|
||||
thisObject.timeScale = undefined
|
||||
thisObject.rateScale.finalize()
|
||||
thisObject.rateScale = undefined
|
||||
thisObject.fitFunction = undefined
|
||||
}
|
||||
|
||||
function initialize (callBackFunction) {
|
||||
@@ -106,6 +108,7 @@ function newTimeMachine () {
|
||||
/* Each Time Machine has a Time Scale and a Right Scale. */
|
||||
|
||||
thisObject.timeScale = newTimeScale()
|
||||
thisObject.timeScale.fitFunction = thisObject.fitFunction
|
||||
|
||||
thisObject.timeScale.container.eventHandler.listenToEvent('Lenght Percentage Changed', function (event) {
|
||||
thisObject.container.frame.width = TIME_MACHINE_WIDTH * event.lenghtPercentage / 100
|
||||
@@ -117,6 +120,7 @@ function newTimeMachine () {
|
||||
thisObject.timeScale.initialize()
|
||||
|
||||
thisObject.rateScale = newRateScale()
|
||||
thisObject.rateScale.fitFunction = thisObject.fitFunction
|
||||
|
||||
thisObject.rateScale.container.eventHandler.listenToEvent('Height Percentage Changed', function (event) {
|
||||
thisObject.container.frame.height = TIME_MACHINE_HEIGHT * event.heightPercentage / 100
|
||||
|
||||
+8
-2
@@ -1,5 +1,5 @@
|
||||
|
||||
function drawScaleDisplay (label1, label2, xExtraOffSet1, xExtraOffSet2, container) {
|
||||
function drawScaleDisplay (label1, label2, xExtraOffSet1, xExtraOffSet2, container, fitFunction) {
|
||||
let fontSize1 = 20
|
||||
let fontSize2 = 10
|
||||
|
||||
@@ -13,7 +13,8 @@ function drawScaleDisplay (label1, label2, xExtraOffSet1, xExtraOffSet2, contain
|
||||
borderColor: UI_COLOR.RUSTED_RED,
|
||||
castShadow: false,
|
||||
backgroundColor: UI_COLOR.DARK,
|
||||
opacity: OPACITY
|
||||
opacity: OPACITY,
|
||||
fitFunction: fitFunction
|
||||
}
|
||||
|
||||
roundedCornersBackground(params)
|
||||
@@ -28,6 +29,9 @@ function drawScaleDisplay (label1, label2, xExtraOffSet1, xExtraOffSet2, contain
|
||||
}
|
||||
|
||||
labelPoint1 = container.frame.frameThisPoint(labelPoint1)
|
||||
let x = labelPoint1.x
|
||||
labelPoint1 = fitFunction(labelPoint1)
|
||||
labelPoint1.x = x
|
||||
|
||||
browserCanvasContext.font = fontSize1 + 'px ' + UI_FONT.PRIMARY
|
||||
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 1)'
|
||||
@@ -42,9 +46,11 @@ function drawScaleDisplay (label1, label2, xExtraOffSet1, xExtraOffSet2, contain
|
||||
}
|
||||
|
||||
labelPoint2 = container.frame.frameThisPoint(labelPoint2)
|
||||
labelPoint2 = fitFunction(labelPoint2)
|
||||
|
||||
browserCanvasContext.font = fontSize2 + 'px ' + UI_FONT.PRIMARY
|
||||
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 1)'
|
||||
|
||||
browserCanvasContext.fillText(label2, labelPoint2.x, labelPoint2.y)
|
||||
}
|
||||
|
||||
+4
-2
@@ -2,10 +2,11 @@ function newRateScale () {
|
||||
const MODULE_NAME = 'Right Scale'
|
||||
|
||||
let thisObject = {
|
||||
heightPercentage: 100,
|
||||
container: undefined,
|
||||
rate: undefined,
|
||||
fitFunction: undefined,
|
||||
visible: true,
|
||||
heightPercentage: 100,
|
||||
physics: physics,
|
||||
draw: draw,
|
||||
getContainer: getContainer,
|
||||
@@ -34,6 +35,7 @@ function newRateScale () {
|
||||
function finalize () {
|
||||
thisObject.container.finalize()
|
||||
thisObject.container = undefined
|
||||
thisObject.fitFunction = undefined
|
||||
}
|
||||
|
||||
function initialize () {
|
||||
@@ -201,7 +203,7 @@ function newRateScale () {
|
||||
let label1 = (Math.trunc(thisObject.rate)).toLocaleString()
|
||||
let label2 = labelArray[1]
|
||||
|
||||
drawScaleDisplay(label1, label2, 10, 40, thisObject.container)
|
||||
drawScaleDisplay(label1, label2, 10, 40, thisObject.container, thisObject.fitFunction)
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -5,6 +5,7 @@ function newTimeScale () {
|
||||
lenghtPercentage: undefined,
|
||||
container: undefined,
|
||||
date: undefined,
|
||||
fitFunction: undefined,
|
||||
visible: true,
|
||||
physics: physics,
|
||||
draw: draw,
|
||||
@@ -34,6 +35,7 @@ function newTimeScale () {
|
||||
function finalize () {
|
||||
thisObject.container.finalize()
|
||||
thisObject.container = undefined
|
||||
thisObject.fitFunction = undefined
|
||||
}
|
||||
|
||||
function initialize () {
|
||||
@@ -202,7 +204,7 @@ function newTimeScale () {
|
||||
let label1 = labelArray[1] + ' ' + labelArray[2] + ' ' + labelArray[3]
|
||||
let label2 = labelArray[4]
|
||||
|
||||
drawScaleDisplay(label1, label2, 10, 60, thisObject.container)
|
||||
drawScaleDisplay(label1, label2, 10, 60, thisObject.container, thisObject.fitFunction)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ function newChartSpace () {
|
||||
timeMachine.container.frame.position.x = thisObject.container.frame.width / 2 - timeMachine.container.frame.width / 2
|
||||
timeMachine.container.frame.position.y = thisObject.container.frame.height / 2 - timeMachine.container.frame.height / 2
|
||||
timeMachine.container.fitFunction = fitIntoVisibleArea
|
||||
timeMachine.fitFunction = fitIntoVisibleArea
|
||||
timeMachine.initialize(onTimeMachineInitialized)
|
||||
|
||||
function onTimeMachineInitialized (err) {
|
||||
|
||||
Reference in new issue
Block a user