Commit 02d110f9 authored by SergeyLuzyanin's avatar SergeyLuzyanin

connector params

parent 474b1a34
...@@ -139,7 +139,8 @@ ...@@ -139,7 +139,8 @@
var tmp; var tmp;
var xc = posX + extX/2, yc = posY + extY/2; var xc = posX + extX/2, yc = posY + extY/2;
if(sPreset === "line"){ if(sPreset === "line"){
flipH = (begin.x > _end.x);
flipV = (begin.y > _end.y);
} }
else{ else{
var sPrefix = "bentConnector"; var sPrefix = "bentConnector";
...@@ -253,16 +254,17 @@ ...@@ -253,16 +254,17 @@
posY = (_end.y + _begin.y)/2.0 - extY/2.0; posY = (_end.y + _begin.y)/2.0 - extY/2.0;
} }
else{ else{
sPreset = "4"; if(_end.y < _begin.y){
rot = Math.PI / 2.0; sPreset = "4";
tmp = extX; flipV = true;
extX = extY; oMapAdj["adj2"] = -((100000*((_end.bounds.b + CONNECTOR_MARGIN - _end.y)/extY) + 0.5) >> 0);
extY = tmp; oMapAdj["adj1"] = ((100000*(((_begin.bounds.r + _end.bounds.l)/2 - _begin.x))/extX) + 0.5) >> 0;
posX = (_end.x + _begin.x)/2.0 - extX/2.0; }
posY = (_end.y + _begin.y)/2.0 - extY/2.0; else{
flipH = true; sPreset = "4";
oMapAdj["adj1"] = (-100000*((_end.bounds.b + CONNECTOR_MARGIN - _end.y)/extX) + 0.5) >> 0; oMapAdj["adj1"] = (100000*(((_begin.bounds.r + _end.bounds.l)/2.0 - _begin.x)/extX) + 0.5) >> 0;
oMapAdj["adj2"] = 100000 - (100000*(((_begin.bounds.r + _end.bounds.l)/2 - (xc - extY/2))/extY) + 0.5) >> 0; oMapAdj["adj2"] = 100000 + ((100000*((_end.bounds.b + CONNECTOR_MARGIN - _end.y)/extY) + 0.5) >> 0);
}
} }
} }
else{ else{
...@@ -288,7 +290,7 @@ ...@@ -288,7 +290,7 @@
flipH = true; flipH = true;
oMapAdj["adj1"] = (100000*(((_begin.bounds.t + _end.bounds.b)/2 - (yc - extX/2))/extX) + 0.5) >> 0; oMapAdj["adj1"] = (100000*(((_begin.bounds.t + _end.bounds.b)/2 - (yc - extX/2))/extX) + 0.5) >> 0;
oMapAdj["adj2"] = 100000 + (100000*(Math.max(CONNECTOR_MARGIN, _end.bounds.r + CONNECTOR_MARGIN - _begin.x)/extY) + 0.5) >> 0; oMapAdj["adj2"] = 100000 + (100000*(CONNECTOR_MARGIN/extY) + 0.5) >> 0;
} }
} }
else{ else{
...@@ -317,17 +319,23 @@ ...@@ -317,17 +319,23 @@
} }
} }
else{ else{
sPreset = "4"; if(_end.y > _begin.y){
rot = Math.PI / 2.0; sPreset = "4";
tmp = extX; rot = Math.PI / 2.0;
extX = extY; tmp = extX;
extY = tmp; extX = extY;
posX = (_end.x + _begin.x)/2.0 - extX/2.0; extY = tmp;
posY = (_end.y + _begin.y)/2.0 - extY/2.0; posX = (_end.x + _begin.x)/2.0 - extX/2.0;
flipH = true; posY = (_end.y + _begin.y)/2.0 - extY/2.0;
flipH = true;
oMapAdj["adj1"] = -((100000*(Math.max(_begin.bounds.b, _end.bounds.b) + CONNECTOR_MARGIN - _end.y)/extX + 0.5) >> 0); oMapAdj["adj1"] = -((100000*(Math.max(_begin.bounds.b, _end.bounds.b) + CONNECTOR_MARGIN - _end.y)/extX + 0.5) >> 0);
oMapAdj["adj2"] = -(100000*((Math.max(_begin.bounds.r, _end.bounds.r) + CONNECTOR_MARGIN - Math.max(_begin.x, _end.x))/extY) + 0.5) >> 0; oMapAdj["adj2"] = -(100000*((Math.max(_begin.bounds.r, _end.bounds.r) + CONNECTOR_MARGIN - Math.max(_begin.x, _end.x))/extY) + 0.5) >> 0;
}
else{
sPreset = "2";
flipV = true;
}
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment