Refactoring Coordinate System Completed

This commit is contained in:
Luis Fernando Molina committed 2018-03-03 12:52:23 +01:00
1 parent 6d7da20eb1
commit d3124dbd93
4 files changed
+20 -15

No files matched your search

Binary file not shown.
+4 -4
View File
@@ -476,8 +476,8 @@
y: j
};
point1 = timeLineCoordinateSystem.inverseTransform(point1, container.frame.height);
point2 = timeLineCoordinateSystem.inverseTransform(point2, container.frame.height);
point1 = timeLineCoordinateSystem.transformThisPoint(point1);
point2 = timeLineCoordinateSystem.transformThisPoint(point2);
point1 = transformThisPoint(point1, container);
point2 = transformThisPoint(point2, container);
@@ -540,8 +540,8 @@
y: timeLineCoordinateSystem.max.y
};
point3 = timeLineCoordinateSystem.inverseTransform(point3, container.frame.height);
point4 = timeLineCoordinateSystem.inverseTransform(point4, container.frame.height);
point3 = timeLineCoordinateSystem.transformThisPoint(point3);
point4 = timeLineCoordinateSystem.transformThisPoint(point4);
point3 = transformThisPoint(point3, container);
point4 = transformThisPoint(point4, container);
+1 -1
View File
@@ -1,6 +1,6 @@
function newProductCard() {
const CONSOLE_LOG = true;
const CONSOLE_LOG = false;
var thisObject = {
container: undefined,
+15 -10
View File
@@ -13,8 +13,8 @@ function newTimeLineCoordinateSystem() {
min: undefined,
max: undefined,
scale: undefined,
inverseTransform: inverseTransform,
inverseTransform2: inverseTransform2,
transformThisPoint: transformThisPoint,
transformThisPoint2: transformThisPoint2,
unInverseTransform: unInverseTransform,
inverseTransformUncappedY: inverseTransformUncappedY,
initializeX: initializeX,
@@ -41,9 +41,11 @@ function newTimeLineCoordinateSystem() {
thisObject.max = max;
thisObject.scale = scale;
let maxHeight;
return thisObject;
function initialize(minValue, maxValue, maxWidth, maxHeight) {
function initialize(minValue, maxValue, maxWidth, pMaxHeight) {
/* Defines the min and max value of rate that we are going to transport to the available screen at the center position. */
@@ -56,7 +58,9 @@ function newTimeLineCoordinateSystem() {
/* Defines the initial Zoom level at center position. */
thisObject.scale.x = maxWidth / (thisObject.max.x - thisObject.min.x);
thisObject.scale.y = maxHeight / (thisObject.max.y - thisObject.min.y);
thisObject.scale.y = pMaxHeight / (thisObject.max.y - thisObject.min.y);
maxHeight = pMaxHeight;
}
@@ -69,32 +73,33 @@ function newTimeLineCoordinateSystem() {
}
function initializeY(minValue, maxValue, maxHeight) {
function initializeY(minValue, maxValue, pMaxHeight) {
thisObject.min.y = minValue.y; // * 0.999; // 0.1% less
thisObject.max.y = maxValue.y; // * 1.001; // 0.1% more
thisObject.scale.y = maxHeight / (thisObject.max.y - thisObject.min.y);
thisObject.scale.y = pMaxHeight / (thisObject.max.y - thisObject.min.y);
maxHeight = pMaxHeight;
}
function inverseTransform(point, inverseY) {
function transformThisPoint(point) {
point = {
x: (point.x - this.min.x) * this.scale.x,
y: inverseY - (point.y - this.min.y) * this.scale.y
y: maxHeight - (point.y - this.min.y) * this.scale.y
};
return point;
}
function inverseTransform2(point, inverseY) {
function transformThisPoint2(point) {
point = {
x: (point.x - this.min.x) * this.scale.x,
y: (inverseY - point.y - this.min.y) * this.scale.y
y: (maxHeight- point.y - this.min.y) * this.scale.y
};
return point;