Working good

This commit is contained in:
Luis Fernando Molina committed 2019-04-11 03:08:56 +02:00
1 parent 650c40e10c
commit 12bdd5dd51
6 files changed
+52 -22

No files matched your search

+2 -2
View File
@@ -546,7 +546,7 @@ function newCanvas () {
/* If it is not, then we check if it is over any of the existing containers at the Chart Space. */
container = thisObject.chartSpace.getContainer(point)
container = thisObject.chartSpace.getContainer(point, GET_CONTAINER_PURPOSE.MOUSE_OVER)
if (container !== undefined && container.detectMouseOver === true) {
container.eventHandler.raiseEvent('onMouseOver', point)
@@ -601,7 +601,7 @@ function newCanvas () {
/* Finally we try the Chart Space. */
let chartContainer = canvas.chartSpace.getContainer({ x: point.x, y: point.y })
let chartContainer = canvas.chartSpace.getContainer({ x: point.x, y: point.y }, GET_CONTAINER_PURPOSE.MOUSE_WHEEL)
if (chartContainer !== undefined && chartContainer.isWheelable === true) {
chartContainer.eventHandler.raiseEvent('Mouse Wheel', event)
+27 -1
View File
@@ -10,7 +10,8 @@ function newContainer () {
isWheelable: false,
name: undefined,
initialize: initialize,
connectToParent: connectToParent
connectToParent: connectToParent,
isForThisPurpose: isForThisPurpose
}
let connectedToParentWidth = false
@@ -72,4 +73,29 @@ function newContainer () {
function onMouseOver (event) {
thisObject.eventHandler.raiseEvent('onMouseOver', event)
}
function isForThisPurpose (purpose) {
if (purpose !== undefined) {
switch (purpose) {
case GET_CONTAINER_PURPOSE.MOUSE_OVER:
if (thisObject.detectMouseOver === true) {
return true
}
break
case GET_CONTAINER_PURPOSE.MOUSE_WHEEL:
if (thisObject.isWheelable === true) {
return true
}
break
case GET_CONTAINER_PURPOSE.MOUSE_CLICK:
if (thisObject.isClickeable === true) {
return true
}
break
default: { return false }
}
}
return false
}
}
+6
View File
@@ -38,6 +38,12 @@ UI_FONT = {
FONT_ASPECT_RATIO = 0.45;
const MIN_ZOOM_LEVEL = -28.25
const GET_CONTAINER_PURPOSE = {
MOUSE_OVER: 1,
MOUSE_WHEEL: 2,
MOUSE_CLICK: 3
}
/* User Interface Panels */
UI_PANEL = {
+5 -9
View File
@@ -104,7 +104,7 @@ function newChartSpace () {
}
}
function getContainer (point) {
function getContainer (point, purpose) {
if (INFO_LOG === true) { logger.write('[INFO] getContainer -> Entering function.') }
let container
@@ -112,17 +112,13 @@ function newChartSpace () {
/* Now we see which is the inner most container that has it */
for (var i = 0; i < this.timeMachines.length; i++) {
container = this.timeMachines[i].getContainer(point)
container = this.timeMachines[i].getContainer(point, purpose)
if (container !== undefined) {
/* We found an inner container which has the point. We return it. */
return container
if (container.isForThisPurpose(purpose)) {
return container
}
}
}
/* The point does not belong to any inner container, so we return the current container. */
return this.container
}
}
+11 -10
View File
@@ -189,23 +189,24 @@ function newTimeMachine () {
timeScale.draw()
}
function getContainer (point) {
if (INFO_LOG === true) { logger.write('[INFO] getContainer -> Entering function.') }
function getContainer (point, purpose) {
let container
/* Now we see which is the inner most container that has it */
container = timeScale.getContainer(point)
if (container !== undefined) { return container }
if (container !== undefined) {
if (container.isForThisPurpose(purpose)) {
return container
}
}
for (let i = 0; i < this.charts.length; i++) {
container = this.charts[i].getContainer(point)
if (container !== undefined) { return container }
if (container !== undefined) {
if (container.isForThisPurpose(purpose)) {
return container
}
}
}
/* The point does not belong to any inner container, so we return the current container. */
return this.container
}
}
+1
View File
@@ -150,3 +150,4 @@ function removeTime (datetime) {
return dateOnly
}