limits on rate labels implemented

This commit is contained in:
Luis Fernando Molina committed 2020-01-19 21:35:30 +01:00
1 parent 787d806af4
commit edc288e344
3 files changed
+15 -9

No files matched your search

+1 -1
View File
@@ -203,7 +203,7 @@ function newTimeMachine () {
rateScaleValueEventSuscriptionId = thisObject.rateScale.container.eventHandler.listenToEvent('Rate Scale Value Changed', rateScaleValueChanged)
rateScaleMouseOverEventSuscriptionId = thisObject.rateScale.container.eventHandler.listenToEvent('onMouseOverScale', rateScaleMouseOver)
thisObject.rateScale.initialize(timeMachineCoordinateSystem, thisObject.container)
thisObject.rateScale.initialize(timeMachineCoordinateSystem, thisObject.container, thisObject.container)
function rateScaleValueChanged (event) {
thisObject.container.frame.height = TIME_MACHINE_HEIGHT * event.scale
+1 -1
View File
@@ -177,7 +177,7 @@ function newTimelineChart () {
rateScaleValueEventSuscriptionId = thisObject.rateScale.container.eventHandler.listenToEvent('Rate Scale Value Changed', rateScaleValueChanged)
rateScaleMouseOverEventSuscriptionId = thisObject.rateScale.container.eventHandler.listenToEvent('onMouseOverScale', rateScaleMouseOver)
rateScaleUpstreamEventSuscriptionId = thisObject.container.parentContainer.eventHandler.listenToEvent('Upstream Rate Scale Value Changed', rateScaleUpstreamChanged)
thisObject.rateScale.initialize(timelineChartCoordinateSystem, thisObject.container.parentContainer)
thisObject.rateScale.initialize(timelineChartCoordinateSystem, thisObject.container.parentContainer, thisObject.container)
function rateScaleUpstreamChanged (event) {
thisObject.rateScale.setScale(event.scale)
+13 -7
View File
@@ -52,6 +52,7 @@ function newRateScale () {
let timeLineCoordinateSystem
let limitingContainer
let rateCalculationsContainer
let mouse = {
position: {
@@ -76,12 +77,14 @@ function newRateScale () {
timeLineCoordinateSystem = undefined
limitingContainer = undefined
rateCalculationsContainer = undefined
mouse = undefined
}
function initialize (pTimeLineCoordinateSystem, pLimitingContainer) {
function initialize (pTimeLineCoordinateSystem, pLimitingContainer, pRateCalculationsContainer) {
timeLineCoordinateSystem = pTimeLineCoordinateSystem
limitingContainer = pLimitingContainer
rateCalculationsContainer = pRateCalculationsContainer
onMouseWheelEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseWheel', onMouseWheel)
onMouseOverEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseOver', onMouseOver)
@@ -326,12 +329,10 @@ function newRateScale () {
/* Mouse Position Rate Calculation */
let ratePoint = {
x: 0,
y: mouse.position.y
y: mouse.position.y + thisObject.offset
}
let mouseRate = getRateFromPoint(ratePoint, limitingContainer, timeLineCoordinateSystem)
thisObject.rate = mouseRate
thisObject.rate = getRateFromPoint(ratePoint, rateCalculationsContainer, timeLineCoordinateSystem)
/* rateScale Positioning */
ratePoint = {
@@ -369,10 +370,15 @@ function newRateScale () {
function drawScaleBox () {
if (thisObject.rate === undefined) { return }
let label = (thisObject.rate - Math.trunc(thisObject.rate)).toFixed(2)
let rate = thisObject.rate
if (rate < timeLineCoordinateSystem.min.y) { rate = timeLineCoordinateSystem.min.y }
if (rate > timeLineCoordinateSystem.max.y) { rate = timeLineCoordinateSystem.max.y }
let label = (rate - Math.trunc(rate)).toFixed(2)
let labelArray = label.split('.')
let label1 = thisObject.payload.node.payload.parentNode.name
let label2 = (Math.trunc(thisObject.rate)).toLocaleString()
let label2 = (Math.trunc(rate)).toLocaleString()
let label3 = labelArray[1]
let icon1 = canvas.designerSpace.iconByUiObjectType.get(thisObject.payload.node.payload.parentNode.type)