Dragging implenented on rate scale

This commit is contained in:
Luis Fernando Molina committed 2020-02-13 11:09:59 +01:00
1 parent 60bf0ef7ca
commit 54b27cd584
3 files changed
+39 -6

No files matched your search

+3 -3
View File
@@ -245,7 +245,7 @@ function newTimeMachine () {
let container
if (thisObject.rateScale !== undefined && thisObject.rateScale.isVisible === true) {
container = thisObject.rateScale.getContainer(point)
container = thisObject.rateScale.getContainer(point, purpose)
if (container !== undefined) {
if (container.isForThisPurpose(purpose)) {
return container
@@ -254,7 +254,7 @@ function newTimeMachine () {
}
if (thisObject.timeScale !== undefined && thisObject.timeScale.isVisible === true) {
container = thisObject.timeScale.getContainer(point)
container = thisObject.timeScale.getContainer(point, purpose)
if (container !== undefined) {
if (container.isForThisPurpose(purpose)) {
return container
@@ -263,7 +263,7 @@ function newTimeMachine () {
}
if (thisObject.timeFrameScale !== undefined && thisObject.timeFrameScale.isVisible === true) {
container = thisObject.timeFrameScale.getContainer(point)
container = thisObject.timeFrameScale.getContainer(point, purpose)
if (container !== undefined) {
if (container.isForThisPurpose(purpose)) {
return container
+2 -2
View File
@@ -293,7 +293,7 @@ function newTimelineChart () {
let container
if (thisObject.rateScale !== undefined && thisObject.rateScale.isVisible === true) {
container = thisObject.rateScale.getContainer(point)
container = thisObject.rateScale.getContainer(point, purpose)
if (container !== undefined) {
if (container.isForThisPurpose(purpose)) {
return container
@@ -302,7 +302,7 @@ function newTimelineChart () {
}
if (thisObject.timeFrameScale !== undefined && thisObject.timeFrameScale.isVisible === true) {
container = thisObject.timeFrameScale.getContainer(point)
container = thisObject.timeFrameScale.getContainer(point, purpose)
if (container !== undefined) {
if (container.isForThisPurpose(purpose)) {
return container
+34 -1
View File
@@ -39,6 +39,10 @@ function newRateScale () {
thisObject.offset = DEFAULT_OFFSET
let draggeableContainer = newContainer()
draggeableContainer.initialize(MODULE_NAME + ' Draggeable')
draggeableContainer.isDraggeable = true
let visible = true
let isMouseOver
@@ -172,8 +176,12 @@ function newRateScale () {
}
}
function getContainer (point) {
function getContainer (point, purpose) {
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
if (purpose === GET_CONTAINER_PURPOSE.DRAGGING) {
return draggeableContainer
}
return thisObject.container
}
}
@@ -239,6 +247,31 @@ function newRateScale () {
offsetTimer--
readObjectState()
positioningPhysics()
draggingPhysics()
}
function draggingPhysics () {
if (draggeableContainer.frame.position.y === 0) { return }
let dragVector = {
x: draggeableContainer.frame.position.x,
y: draggeableContainer.frame.position.y
}
draggeableContainer.frame.position.x = 0
draggeableContainer.frame.position.y = 0
let point = {
x: 0,
y: -dragVector.y
}
let newMaxRate = getRateFromPointAtContainer(point, limitingContainer, coordinateSystem)
let yDifferenceMaxMin = coordinateSystem.max.y - coordinateSystem.min.y
coordinateSystem.min.y = newMaxRate - yDifferenceMaxMin
coordinateSystem.max.y = newMaxRate
coordinateSystem.recalculateScale()
}
function positioningPhysics () {