From abb09e18d88387926d39cf829545b99c8fb85fd5 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Fri, 10 Jan 2020 14:10:28 +0100 Subject: [PATCH] Bug Fixed, scales well limited --- Scales/Commons.js | 9 ++------- Scales/RateScale.js | 6 ++++-- Scales/TimeFrameScale.js | 6 ++++-- Scales/TimeScale.js | 6 ++++-- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Scales/Commons.js b/Scales/Commons.js index db22d6459..b4259b9c2 100644 --- a/Scales/Commons.js +++ b/Scales/Commons.js @@ -1,5 +1,5 @@ -function drawScaleDisplay (label1, label2, label3, xExtraOffSet1, xExtraOffSet2, xExtraOffSet3, icon1, icon2, container, fitFunction) { +function drawScaleDisplay (label1, label2, label3, xExtraOffSet1, xExtraOffSet2, xExtraOffSet3, icon1, icon2, container) { let fontSize1 = 10 let fontSize2 = 20 let fontSize3 = 10 @@ -14,8 +14,7 @@ function drawScaleDisplay (label1, label2, label3, xExtraOffSet1, xExtraOffSet2, borderColor: UI_COLOR.RUSTED_RED, castShadow: false, backgroundColor: UI_COLOR.DARK, - opacity: OPACITY, - fitFunction: fitFunction + opacity: OPACITY } roundedCornersBackground(params) @@ -32,7 +31,6 @@ function drawScaleDisplay (label1, label2, label3, xExtraOffSet1, xExtraOffSet2, labelPoint1 = container.frame.frameThisPoint(labelPoint1) let x = labelPoint1.x - labelPoint1 = fitFunction(labelPoint1) labelPoint1.x = x browserCanvasContext.font = fontSize1 + 'px ' + UI_FONT.PRIMARY @@ -49,7 +47,6 @@ function drawScaleDisplay (label1, label2, label3, xExtraOffSet1, xExtraOffSet2, } labelPoint2 = container.frame.frameThisPoint(labelPoint2) - labelPoint2 = fitFunction(labelPoint2) browserCanvasContext.font = fontSize2 + 'px ' + UI_FONT.PRIMARY browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 1)' @@ -65,7 +62,6 @@ function drawScaleDisplay (label1, label2, label3, xExtraOffSet1, xExtraOffSet2, } labelPoint3 = container.frame.frameThisPoint(labelPoint3) - labelPoint3 = fitFunction(labelPoint3) browserCanvasContext.font = fontSize3 + 'px ' + UI_FONT.PRIMARY browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', 1)' @@ -108,4 +104,3 @@ function drawScaleDisplay (label1, label2, label3, xExtraOffSet1, xExtraOffSet2, } } } - diff --git a/Scales/RateScale.js b/Scales/RateScale.js index 1d8ba85ca..5f81177b6 100644 --- a/Scales/RateScale.js +++ b/Scales/RateScale.js @@ -138,6 +138,9 @@ function newRateScale () { upCorner = transformThisPoint(upCorner, limitingContainer) bottonCorner = transformThisPoint(bottonCorner, limitingContainer) + upCorner = limitingContainer.fitFunction(upCorner, true) + bottonCorner = limitingContainer.fitFunction(bottonCorner, true) + /* Mouse Position Rate Calculation */ let ratePoint = { x: 0, @@ -156,7 +159,6 @@ function newRateScale () { ratePoint = transformThisPoint(ratePoint, limitingContainer.frame.container) ratePoint.y = mouse.position.y - thisObject.container.frame.height / 2 + thisObject.container.frame.height - ratePoint = limitingContainer.fitFunction(ratePoint, true) /* Checking against the container limits. */ if (ratePoint.x < upCorner.x) { ratePoint.x = upCorner.x } @@ -287,6 +289,6 @@ function newRateScale () { let icon1 = canvas.designerSpace.iconByUiObjectType.get(thisObject.payload.node.payload.parentNode.type) let icon2 = canvas.designerSpace.iconByUiObjectType.get(thisObject.payload.node.type) - drawScaleDisplay(label1, label2, label3, 0, 0, 0, icon1, icon2, thisObject.container, thisObject.fitFunction) + drawScaleDisplay(label1, label2, label3, 0, 0, 0, icon1, icon2, thisObject.container) } } diff --git a/Scales/TimeFrameScale.js b/Scales/TimeFrameScale.js index 40b27b7cf..ed3c6c5c6 100644 --- a/Scales/TimeFrameScale.js +++ b/Scales/TimeFrameScale.js @@ -108,6 +108,9 @@ function newTimeFrameScale () { upCorner = transformThisPoint(upCorner, limitingContainer) bottonCorner = transformThisPoint(bottonCorner, limitingContainer) + upCorner = limitingContainer.fitFunction(upCorner, true) + bottonCorner = limitingContainer.fitFunction(bottonCorner, true) + /* Positioning */ timePoint = { x: 0, @@ -116,7 +119,6 @@ function newTimeFrameScale () { timePoint = transformThisPoint(timePoint, limitingContainer.frame.container) timePoint.x = mouse.position.x - thisObject.container.frame.width / 2 - timePoint = limitingContainer.fitFunction(timePoint, true) /* Checking against the container limits. */ if (timePoint.x < upCorner.x) { timePoint.x = upCorner.x } @@ -226,6 +228,6 @@ function newTimeFrameScale () { let icon1 = canvas.designerSpace.iconByUiObjectType.get(thisObject.payload.node.payload.parentNode.type) let icon2 = canvas.designerSpace.iconByUiObjectType.get(thisObject.payload.node.type) - drawScaleDisplay(label1, label2, label3, 0, 0, 0, icon1, icon2, thisObject.container, thisObject.fitFunction) + drawScaleDisplay(label1, label2, label3, 0, 0, 0, icon1, icon2, thisObject.container) } } diff --git a/Scales/TimeScale.js b/Scales/TimeScale.js index 4a1039573..9bd8a5372 100644 --- a/Scales/TimeScale.js +++ b/Scales/TimeScale.js @@ -138,6 +138,9 @@ function newTimeScale () { upCorner = transformThisPoint(upCorner, limitingContainer) bottonCorner = transformThisPoint(bottonCorner, limitingContainer) + upCorner = limitingContainer.fitFunction(upCorner, true) + bottonCorner = limitingContainer.fitFunction(bottonCorner, true) + /* Mouse Position Date Calculation */ let timePoint = { x: mouse.position.x, @@ -156,7 +159,6 @@ function newTimeScale () { timePoint = transformThisPoint(timePoint, limitingContainer.frame.container) timePoint.x = mouse.position.x - thisObject.container.frame.width / 2 - timePoint = limitingContainer.fitFunction(timePoint) /* Checking against the container limits. */ if (timePoint.x < upCorner.x) { timePoint.x = upCorner.x } @@ -287,6 +289,6 @@ function newTimeScale () { let icon1 = canvas.designerSpace.iconByUiObjectType.get(thisObject.payload.node.payload.parentNode.type) let icon2 = canvas.designerSpace.iconByUiObjectType.get(thisObject.payload.node.type) - drawScaleDisplay(label1, label2, label3, 0, 0, 0, icon1, icon2, thisObject.container, thisObject.fitFunction) + drawScaleDisplay(label1, label2, label3, 0, 0, 0, icon1, icon2, thisObject.container) } }