Scales moving smoothly while with mouse over

This commit is contained in:
Luis Fernando Molina committed 2020-01-08 19:48:55 +01:00
1 parent 0d70f64c56
commit 401077f99c
2 files changed
+49 -21

No files matched your search

+23 -4
View File
@@ -46,6 +46,8 @@ function newTimeMachine () {
let onMouseNotOverEventSuscriptionId
let timeScaleEventSuscriptionId
let rateScaleEventSuscriptionId
let timeScaleMouseOverEventSuscriptionId
let rateScaleMouseOverEventSuscriptionId
setupContainer()
return thisObject
@@ -66,6 +68,8 @@ function newTimeMachine () {
thisObject.rateScale.container.eventHandler.stopListening(rateScaleEventSuscriptionId)
thisObject.container.eventHandler.stopListening(onMouseOverEventSuscriptionId)
thisObject.container.eventHandler.stopListening(onMouseNotOverEventSuscriptionId)
thisObject.timeScale.container.eventHandler.stopListening(timeScaleMouseOverEventSuscriptionId)
thisObject.rateScale.container.eventHandler.stopListening(rateScaleMouseOverEventSuscriptionId)
for (let i = 0; i < thisObject.timelineCharts.length; i++) {
let chart = thisObject.timelineCharts[i]
@@ -138,14 +142,29 @@ function newTimeMachine () {
thisObject.rateScale.visible = false
}
timeScaleMouseOverEventSuscriptionId = thisObject.timeScale.container.eventHandler.listenToEvent('onMouseOver', timeScaleMouseOver)
function timeScaleMouseOver (event) {
thisObject.rateScale.visible = false
mouse.position.x = event.x
mouse.position.y = event.y
}
rateScaleMouseOverEventSuscriptionId = thisObject.rateScale.container.eventHandler.listenToEvent('onMouseOver', rateScaleMouseOver)
function rateScaleMouseOver (event) {
thisObject.timeScale.visible = false
mouse.position.x = event.x
mouse.position.y = event.y
}
callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE)
}
function getContainer (point, purpose) {
let container
if (thisObject.timeScale !== undefined) {
container = thisObject.timeScale.getContainer(point)
if (thisObject.rateScale !== undefined) {
container = thisObject.rateScale.getContainer(point)
if (container !== undefined) {
if (container.isForThisPurpose(purpose)) {
return container
@@ -153,8 +172,8 @@ function newTimeMachine () {
}
}
if (thisObject.rateScale !== undefined) {
container = thisObject.rateScale.getContainer(point)
if (thisObject.timeScale !== undefined) {
container = thisObject.timeScale.getContainer(point)
if (container !== undefined) {
if (container.isForThisPurpose(purpose)) {
return container
+26 -17
View File
@@ -51,6 +51,7 @@ function newTimelineChart () {
let onMouseOverEventSuscriptionId
let onMouseNotOverEventSuscriptionId
let timeFrameScaleEventSuscriptionId
let timeFrameScaleMouseOverEventSuscriptionId
let mouse = {
position: {
@@ -74,6 +75,7 @@ function newTimelineChart () {
thisObject.container.eventHandler.stopListening(onMouseOverEventSuscriptionId)
thisObject.container.eventHandler.stopListening(onMouseNotOverEventSuscriptionId)
thisObject.timeFrameScale.container.eventHandler.stopListening(timeFrameScaleEventSuscriptionId)
thisObject.timeFrameScale.container.eventHandler.stopListening(timeFrameScaleMouseOverEventSuscriptionId)
plotterManager.finalize()
plotterManager = undefined
@@ -94,23 +96,6 @@ function newTimelineChart () {
market = pMarket
timeLineCoordinateSystem = pTimeLineCoordinateSystem
onMouseOverEventSuscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseOver', onMouseOver)
function onMouseOver (event) {
thisObject.timeFrameScale.visible = true
mouse.position.x = event.x
mouse.position.y = event.y
saveUserPosition(thisObject.container, timeLineCoordinateSystem, event)
}
onMouseNotOverEventSuscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseNotOver', onMouseNotOver)
function onMouseNotOver (event) {
thisObject.timeFrameScale.visible = false
}
let panelOwner = exchange + ' ' + market.quotedAsset + '/' + market.baseAsset
productsPanelHandle = canvas.panelsSpace.createNewPanel('Products Panel', undefined, panelOwner)
let productsPanel = canvas.panelsSpace.getPanel(productsPanelHandle, panelOwner)
@@ -192,6 +177,30 @@ function newTimelineChart () {
thisObject.timeFrameScale.initialize()
onMouseOverEventSuscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseOver', onMouseOver)
function onMouseOver (event) {
thisObject.timeFrameScale.visible = true
mouse.position.x = event.x
mouse.position.y = event.y
saveUserPosition(thisObject.container, timeLineCoordinateSystem, event)
}
onMouseNotOverEventSuscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseNotOver', onMouseNotOver)
function onMouseNotOver (event) {
thisObject.timeFrameScale.visible = false
}
timeFrameScaleMouseOverEventSuscriptionId = thisObject.timeFrameScale.container.eventHandler.listenToEvent('onMouseOver', timeFrameScaleMouseOver)
function timeFrameScaleMouseOver (event) {
mouse.position.x = event.x
mouse.position.y = event.y
}
initializationReady = true
callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE)
return