message: uncaught exception: y must be defined, line:0, :

stackTrace()@http://app.wisemapping.com/js/core.js:14
This commit is contained in:
Paulo Gustavo Veiga 2012-08-28 20:48:34 -03:00
parent 0a655ff802
commit 4288ad52dc

View File

@ -46,7 +46,10 @@ mindplot.util.Shape =
calculateRelationShipPointCoordinates:function (topic, controlPoint) { calculateRelationShipPointCoordinates:function (topic, controlPoint) {
var size = topic.getSize(); var size = topic.getSize();
var position = topic.getPosition(); 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 y, x;
var gap = 5; var gap = 5;
if (controlPoint.y > position.y + (size.height / 2)) { if (controlPoint.y > position.y + (size.height / 2)) {
@ -79,7 +82,9 @@ mindplot.util.Shape =
calculateDefaultControlPoints:function (srcPos, tarPos) { calculateDefaultControlPoints:function (srcPos, tarPos) {
var y = srcPos.y - tarPos.y; var y = srcPos.y - tarPos.y;
var x = srcPos.x - tarPos.x; 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 l = Math.sqrt(y * y + x * x) / 3;
var fix = 1; var fix = 1;
if (srcPos.x > tarPos.x) { if (srcPos.x > tarPos.x) {