Dragging from the center impacts all scales downstream
This commit is contained in:
1 parent
2d4eac8e15
commit
fb83ffb852
3 files changed
+28
-8
No files matched your search
@@ -163,7 +163,11 @@ function newEdgeEditor () {
|
||||
coordinateSystem.max.x = newMinDate.valueOf() + xDifferenceMaxMin
|
||||
coordinateSystem.min.y = newMaxRate - yDifferenceMaxMin
|
||||
coordinateSystem.max.y = newMaxRate
|
||||
coordinateSystem.recalculateScale()
|
||||
let event = {
|
||||
type: 'center dragged',
|
||||
dragVector: dragVector
|
||||
}
|
||||
coordinateSystem.recalculateScale(event)
|
||||
}
|
||||
}
|
||||
thisObject.container.parentContainer.eventHandler.raiseEvent('onMouseOver', mouse.position)
|
||||
@@ -188,7 +192,7 @@ function newEdgeEditor () {
|
||||
coordinateSystem.max.y = newMaxRate
|
||||
coordinateSystem.maxHeight = thisObject.container.parentContainer.frame.height
|
||||
let event = {
|
||||
border: 'top',
|
||||
type: 'top dragged',
|
||||
dragVector: dragVector
|
||||
}
|
||||
coordinateSystem.recalculateScale(event)
|
||||
@@ -221,7 +225,7 @@ function newEdgeEditor () {
|
||||
coordinateSystem.min.y = newMinRate
|
||||
coordinateSystem.maxHeight = thisObject.container.parentContainer.frame.height
|
||||
let event = {
|
||||
border: 'bottom',
|
||||
type: 'bottom dragged',
|
||||
dragVector: dragVector
|
||||
}
|
||||
coordinateSystem.recalculateScale(event)
|
||||
|
||||
@@ -233,7 +233,7 @@ function newTimelineChart () {
|
||||
|
||||
function onScaleChanged (event) {
|
||||
if (thisObject.rateScale !== undefined) {
|
||||
thisObject.rateScale.onBorderChanged(event)
|
||||
thisObject.rateScale.onUpstreamScaleChanged(event)
|
||||
}
|
||||
timelineChartCoordinateSystem.min.x = timeMachineCoordinateSystem.min.x
|
||||
timelineChartCoordinateSystem.max.x = timeMachineCoordinateSystem.max.x
|
||||
|
||||
+20
-4
@@ -10,7 +10,7 @@ function newRateScale () {
|
||||
maxValue: undefined,
|
||||
isVisible: true,
|
||||
layersOn: undefined,
|
||||
onBorderChanged: onBorderChanged,
|
||||
onUpstreamScaleChanged: onUpstreamScaleChanged,
|
||||
onMouseOverSomeTimeMachineContainer: onMouseOverSomeTimeMachineContainer,
|
||||
physics: physics,
|
||||
draw: draw,
|
||||
@@ -244,9 +244,25 @@ function newRateScale () {
|
||||
coordinateSystem.recalculateScale()
|
||||
}
|
||||
|
||||
function onBorderChanged (event) {
|
||||
function onUpstreamScaleChanged (event) {
|
||||
if (event === undefined) { return }
|
||||
if (event.border === 'top') {
|
||||
if (event.type === 'center dragged') {
|
||||
let point = {
|
||||
x: event.dragVector.x,
|
||||
y: -event.dragVector.y
|
||||
}
|
||||
let newMinDate = getDateFromPointAtContainer(point, rateCalculationsContainer, coordinateSystem)
|
||||
let newMaxRate = getRateFromPointAtContainer(point, rateCalculationsContainer, coordinateSystem)
|
||||
let xDifferenceMaxMin = coordinateSystem.max.x - coordinateSystem.min.x
|
||||
let yDifferenceMaxMin = coordinateSystem.max.y - coordinateSystem.min.y
|
||||
coordinateSystem.min.x = newMinDate.valueOf()
|
||||
coordinateSystem.max.x = newMinDate.valueOf() + xDifferenceMaxMin
|
||||
coordinateSystem.min.y = newMaxRate - yDifferenceMaxMin
|
||||
coordinateSystem.max.y = newMaxRate
|
||||
|
||||
coordinateSystem.recalculateScale()
|
||||
}
|
||||
if (event.type === 'top dragged') {
|
||||
let point = {
|
||||
x: event.dragVector.x,
|
||||
y: event.dragVector.y
|
||||
@@ -257,7 +273,7 @@ function newRateScale () {
|
||||
coordinateSystem.maxHeight = rateCalculationsContainer.frame.height
|
||||
coordinateSystem.recalculateScale()
|
||||
}
|
||||
if (event.border === 'bottom') {
|
||||
if (event.type === 'bottom dragged') {
|
||||
let point = {
|
||||
x: event.dragVector.x,
|
||||
y: event.dragVector.y + rateCalculationsContainer.frame.height
|
||||
|
||||
Reference in new issue
Block a user