Coordinate System raising events when scale changes

This commit is contained in:
Luis Fernando Molina committed 2020-01-31 11:33:07 +01:00
1 parent 58cfd502e2
commit 9cc7e1ccd9
6 files changed
+49 -13

No files matched your search

+14 -1
View File
@@ -14,6 +14,7 @@ function newCoordinateSystem () {
maxHeight: undefined,
maxWidth: undefined,
scale: undefined,
eventHandler: undefined,
recalculateScale: recalculateScale,
transformThisPoint: transformThisPoint,
transformThisPoint2: transformThisPoint2,
@@ -21,7 +22,8 @@ function newCoordinateSystem () {
inverseTransformUncappedY: inverseTransformUncappedY,
initializeX: initializeX,
initializeY: initializeY,
initialize: initialize
initialize: initialize,
finalize: finalize
}
thisObject.min = {
@@ -37,8 +39,16 @@ function newCoordinateSystem () {
y: 0
}
thisObject.eventHandler = newEventHandler()
thisObject.eventHandler.name = 'Coordinate System'
return thisObject
function finalize () {
thisObject.eventHandler.finalize()
thisObject.eventHandler = undefined
}
function initialize (minValue, maxValue, pMaxWidth, pMaxHeight) {
/* Defines the min and max value of rate that we are going to transport to the available screen at the center position. */
thisObject.min.x = minValue.x // * 0.999; // 0.1% less
@@ -57,6 +67,9 @@ function newCoordinateSystem () {
/* Defines the initial Zoom level at center position. */
thisObject.scale.x = thisObject.maxWidth / (thisObject.max.x - thisObject.min.x)
thisObject.scale.y = thisObject.maxHeight / (thisObject.max.y - thisObject.min.y)
thisObject.eventHandler.raiseEvent('Scale Changed')
console.log('Scale Changed')
}
function initializeX (minValue, maxValue, maxWidth) {