From 4288ad52dc0bd0b2bdec382448bfac932b1ca20b Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Tue, 28 Aug 2012 20:48:34 -0300 Subject: [PATCH] message: uncaught exception: y must be defined, line:0, : stackTrace()@http://app.wisemapping.com/js/core.js:14 --- mindplot/src/main/javascript/util/Shape.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mindplot/src/main/javascript/util/Shape.js b/mindplot/src/main/javascript/util/Shape.js index 1b389ade..ad990e4a 100644 --- a/mindplot/src/main/javascript/util/Shape.js +++ b/mindplot/src/main/javascript/util/Shape.js @@ -46,7 +46,10 @@ mindplot.util.Shape = calculateRelationShipPointCoordinates:function (topic, controlPoint) { var size = topic.getSize(); var position = topic.getPosition(); - var m = (position.y - controlPoint.y) / (position.x - controlPoint.x); + var div = (position.x - controlPoint.x); + div = (Math.mod(div) > 0.1 ? div : 0.1); // Prevent division by 0. + + var m = (position.y - controlPoint.y) / div; var y, x; var gap = 5; if (controlPoint.y > position.y + (size.height / 2)) { @@ -79,7 +82,9 @@ mindplot.util.Shape = calculateDefaultControlPoints:function (srcPos, tarPos) { var y = srcPos.y - tarPos.y; var x = srcPos.x - tarPos.x; - var m = y / (x == 0 ? 1 : x); // Prevent division by 0. + var div = (Math.abs(x) > 0.1 ? x : 0.1); // Prevent division by 0. + + var m = y / div; var l = Math.sqrt(y * y + x * x) / 3; var fix = 1; if (srcPos.x > tarPos.x) {