Scales do not leave visible area

This commit is contained in:
Luis Fernando Molina committed 2020-01-08 19:13:25 +01:00
1 parent f5fb6e462e
commit 0d70f64c56
3 files changed
+17 -11

No files matched your search

+5 -5
View File
@@ -301,30 +301,30 @@ function newTimeMachine () {
/* timeScale Positioning */
thisObject.timeScale.container.frame.position.x = mouse.position.x - thisObject.timeScale.container.frame.width / 2
timePoint = {
x: 0,
y: 0
}
timePoint = transformThisPoint(timePoint, thisObject.container.frame.container)
timePoint.x = mouse.position.x - thisObject.timeScale.container.frame.width / 2
timePoint = thisObject.container.fitFunction(timePoint)
thisObject.timeScale.container.frame.position.x = timePoint.x
thisObject.timeScale.container.frame.position.y = timePoint.y
/* rateScale Positioning */
thisObject.rateScale.container.frame.position.y = mouse.position.y - thisObject.rateScale.container.frame.height / 2
ratePoint = {
x: thisObject.container.frame.width,
y: 0
}
ratePoint = transformThisPoint(ratePoint, thisObject.container.frame.container)
ratePoint = thisObject.container.fitFunction(ratePoint)
ratePoint.y = mouse.position.y - thisObject.rateScale.container.frame.height / 2 + thisObject.rateScale.container.frame.height
ratePoint = thisObject.container.fitFunction(ratePoint, true)
thisObject.rateScale.container.frame.position.y = ratePoint.y - thisObject.rateScale.container.frame.height
thisObject.rateScale.container.frame.position.x = ratePoint.x - thisObject.rateScale.container.frame.width
}
+3 -3
View File
@@ -279,16 +279,16 @@ function newTimelineChart () {
/* thisObject.timeFrameScale Positioning */
thisObject.timeFrameScale.container.frame.position.x = mouse.position.x - thisObject.timeFrameScale.container.frame.width / 2
timePoint = {
x: 0,
y: thisObject.container.frame.height
}
timePoint = transformThisPoint(timePoint, thisObject.container.frame.container)
timePoint = thisObject.container.fitFunction(timePoint)
timePoint.x = mouse.position.x - thisObject.timeFrameScale.container.frame.width / 2
timePoint = thisObject.container.fitFunction(timePoint, true)
thisObject.timeFrameScale.container.frame.position.x = timePoint.x
thisObject.timeFrameScale.container.frame.position.y = timePoint.y - thisObject.timeFrameScale.container.frame.height
}
+9 -3
View File
@@ -138,7 +138,7 @@ function newChartSpace () {
viewPort.displace(displaceVector, true)
}
function fitIntoVisibleArea (point) {
function fitIntoVisibleArea (point, fullVisible) {
/* Here we check the boundaries of the resulting points, so they dont go out of the visible area. */
let returnPoint = {
@@ -154,8 +154,14 @@ function newChartSpace () {
returnPoint.x = 0
}
if (point.y > COCKPIT_SPACE_POSITION + COCKPIT_SPACE_HEIGHT / 2) {
returnPoint.y = COCKPIT_SPACE_POSITION + COCKPIT_SPACE_HEIGHT / 2
if (fullVisible === true) {
if (point.y > COCKPIT_SPACE_POSITION) {
returnPoint.y = COCKPIT_SPACE_POSITION
}
} else {
if (point.y > COCKPIT_SPACE_POSITION + COCKPIT_SPACE_HEIGHT / 2) {
returnPoint.y = COCKPIT_SPACE_POSITION + COCKPIT_SPACE_HEIGHT / 2
}
}
if (point.y < 0) {