From 31d47ce6f41d1414f33410a84d71ac6474012861 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 3 May 2018 20:20:31 +0200 Subject: [PATCH] Code Cleaning --- .vs/AAWeb/v15/.suo | Bin 69632 -> 69120 bytes Balls.js | 12 --- Canvas.js | 51 +---------- Project.njsproj | 2 - Zoom.js | 221 --------------------------------------------- index.html | 2 - 6 files changed, 1 insertion(+), 287 deletions(-) delete mode 100644 Balls.js delete mode 100644 Zoom.js diff --git a/.vs/AAWeb/v15/.suo b/.vs/AAWeb/v15/.suo index 75367417b2a6461d03dee4e7738a432a1c39e99f..f9bba85260fe98f36e6814c276d92d0808532ff5 100644 GIT binary patch delta 2335 zcmbuAdu&rx9LMiDy)A9mVY_zS?8>;~v6XkrQzjeRDB~exY$!|uds)OR4a}`Y*pL<& zlIVo3zdr;51}+*CAR?T^@CY!r7?3{%;vm0;|Oh%qV#v@aaX$VbIgLMH?h)hRHkmr$7WG3Q9o<-&$Q;;Hr^62$c=3#q` zBy}zvWL(rg1XcRqm;rM5U{kHZ9Uwg`QP0RDT9N?wwOkFo1M(vC`)43MX>!t&>SQ53 z4G3wR>`UrN?ML;bJ_Vmm>REN-=LLx52`Xz*N7x&jySktC0h2^Fdsq|DB zTbq$L#AVY*T&6B)v%Ho{Stqey+YWKZvV}c%Y+x&62Ow;Xu>H_$EjN&bD=Cv{=Q}H z>SQCFIcgX7)wfy9HJhfyH6FwtP;y-l+}mWBgwv!rpv8NaxghMDZ_>7rEUGC&2ZxJ0 zvqo_EAj2&R-Q7%`%hd%2Rh88x+a@%&MpSN zSF%NR)$42$on6`)BCQzRyjWT;)k|ZgW+^DGd`ve4s;8;79Mo!ufi4DIQqH10)Vf5f z!?d8(4As>W)fxtY8aKG>1D$o5F^eqR**BQ_stnQkXsn?KqQS}H_j)r+Nx_SX?lrTt z4T`&K;AGgxwo)XQ)CGf3)YT5BT5NFO#BsJ;dtmgs3|PJ<3%uQ_5bW9keN9bjBNvU$ z>$z-}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@(fDpIVFibHit=#drl zoj2j{dlE2bEGlN|&%nPSZkXAbB= 0) { - - /* We need to apply the Radius zoom to the cointainer of the ball where the zoom was made, for that reason, we need the ball. */ - - // balls[ballIndex].container.zoom.rZoom(delta); // Zoom is applied to ball radius. - - } else { - - /* We check if the mouse is over any of the existing containers. */ - - let point = { - x: event.pageX, - y: event.pageY - }; - - /* - var container = canvas.chartSpace.getContainer(point); - - if (container !== undefined && container.isZoomeable === true) { - - if (container.zoom.xyZoom(delta) === true) { - - updateBallsTargets(); - - } - - } */ - - viewPort.applyZoom(delta); - } + viewPort.applyZoom(delta); return false; // This instructs the browser not to take the event and scroll the page. } @@ -485,24 +454,6 @@ function newCanvas() { containerBeingDragged.frame.position.y = containerBeingDragged.frame.position.y + displaceVector.y; } - - - - - - /* - if (containerBeingDragged.displacement.displace(diffX, diffY) === true) { - - updateBallsTargets(); // TODO: this should not be here - - } else - { - // If the displacement can not be performed, then we dont abort the dragging operation, just allow the user to move the mouse in some other direction. - } - */ - - - } /* Finally we set the starting point of the new dragVector at this current point. */ diff --git a/Project.njsproj b/Project.njsproj index fb318ddd7..d012c9cb2 100644 --- a/Project.njsproj +++ b/Project.njsproj @@ -34,7 +34,6 @@ - Code @@ -121,7 +120,6 @@ - diff --git a/Zoom.js b/Zoom.js deleted file mode 100644 index 8060099be..000000000 --- a/Zoom.js +++ /dev/null @@ -1,221 +0,0 @@ -/* The Zoom is the factor that amplifies the current container coordinates, and everything included in that container. */ - - -function newZoom() { - - var zoom = { - containerName: "", // This is for debugging purposes only. - parentZoom: undefined, // Here we store the parent cointainer zoom object. - container: undefined, - levelX: 0, // this is the actual zoom level on the x axis. - incrementX: 0.1, - levelY: 0, - incrementY: 0.1, - levelR: -15, - incrementR: 0.05, - levelM: -15, - incrementM: 0.05, - xyZoom: xyZoom, - xZoom: xZoom, - yZoom: yZoom, - rZoom: rZoom, - mZoom: mZoom, - zoomThisPoint: zoomThisPoint, - unzoomThisPoint: unzoomThisPoint, - stack: stack, - level: level - - }; - - return zoom; - - function xyZoom(amount) { - - var tempZoom = newZoom(); - tempZoom.levelX = this.levelX + amount; - tempZoom.levelY = this.levelY + amount; - tempZoom.container = this.container; - tempZoom.parentZoom = this.parentZoom; - - if (this.container.frame.canYouZoomHere(tempZoom)) { - - /* Now we displace */ - - this.levelX = this.levelX + amount; - this.levelY = this.levelY + amount; - - if (this.levelX < -50) { - this.levelX = -50; // There is a minimun zoom level. - } - - if (this.levelY < -50) { - this.levelY = -50; // There is a minimun zoom level. - } - - return true; - } - - return false; - - } - - function xZoom(amount) { - - this.levelX = this.levelX + amount; - - if (this.levelX < -10) { - this.levelX = -10; // There is a minimun zoom level. - } - updateBallsTargets(); - - } - - function yZoom(amount) { - - this.levelY = this.levelY + amount; - - if (this.levelY < -10) { - this.levelY = -10; // There is a minimun zoom level. - } - updateBallsTargets(); - - } - - - function rZoom(amount) { - - this.levelR = this.levelR + amount; - - var zoomLimit = - 1 / this.incrementR; - - if (zoom.levelR <= zoomLimit + 1) { - zoom.levelR = zoomLimit + 2; // There is a minimun zoom level. - } - updateBallsTargets(); - - } - - function mZoom(amount) { - - this.levelM = this.levelM + amount; - - var zoomLimit = - 1 / this.incrementM; - - if (zoom.levelM <= zoomLimit + 1) { - zoom.levelM = zoomLimit + 2; // There is a minimun zoom level. - } - updateBallsTargets(); - - } - - function zoomThisPoint(point) { - - if (this.parentZoom !== undefined) { - - point = this.parentZoom.zoomThisPoint(point); - - } - - /* The zoom center is needed to calculate the zoom for each point within this container. */ - - zoomAxisCenter = { - x: this.container.frame.width / 2, - y: this.container.frame.height / 2 - } - - /* Guess what? yes, the axis center itself must be framed and displaced before being used.*/ - - zoomAxisCenter = this.container.frame.frameThisPoint(zoomAxisCenter); - zoomAxisCenter = this.container.displacement.displaceThisPoint(zoomAxisCenter); - - var diffX = point.x - zoomAxisCenter.x ; - - point.x = zoomAxisCenter.x + diffX + diffX * this.incrementX * this.levelX; - - var diffY = point.y - zoomAxisCenter.y; - - point.y = zoomAxisCenter.y + diffY + diffY * this.incrementY * this.levelY; - - return point; - } - - function unzoomThisPoint(pointWithZoom) { - - if (this.parentZoom !== undefined) { - - pointWithZoom = this.parentZoom.unzoomThisPoint(pointWithZoom); - - } - - /* The zoom center is needed to calculate the zoom for each point within this container. */ - - zoomAxisCenter = { - x: this.container.frame.width / 2, - y: this.container.frame.height / 2 - } - - /* Guess what? yes, the axis center itself must be framed and displaced before being used.*/ - - zoomAxisCenter = this.container.frame.frameThisPoint(zoomAxisCenter); - zoomAxisCenter = this.container.displacement.displaceThisPoint(zoomAxisCenter); - - var pointWithoutZoom = { - x: 0, - y: 0 - } - - pointWithoutZoom.x = (pointWithZoom.x - zoomAxisCenter.x) / (1 + this.incrementX * this.levelX) + zoomAxisCenter.x; - pointWithoutZoom.y = (pointWithZoom.y - zoomAxisCenter.y) / (1 + this.incrementY * this.levelY) + zoomAxisCenter.y; - - return pointWithoutZoom; - - } - - - - - function level() { - - /* This function provides a sense of the zoom level all through the stack of containers object's zoom. */ - - var fullLevel = 0; - - if (this.parentZoom !== undefined) { - - fullLevel = this.parentZoom.level(); - - } - - fullLevel = fullLevel + (this.levelX + this.levelY) / 2; - - return fullLevel; - } - - function stack() { - - /* This function provides the factor by which the stack of cointainers need to be multiplied to aquire the final zoom. */ - - var fullStack = { - x: 1, - y: 1 - } - - if (this.parentZoom !== undefined) { - - fullStack = this.parentZoom.stack(); - - } - - fullStack.x = fullStack.x + fullStack.x * this.levelX * this.incrementX; - fullStack.y = fullStack.y + fullStack.y * this.levelY * this.incrementY; - - return fullStack; - } -} - - - - - - - diff --git a/index.html b/index.html index 6c02b864e..41fd26a43 100644 --- a/index.html +++ b/index.html @@ -28,7 +28,6 @@ - @@ -46,7 +45,6 @@ -