summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidharth Singh2012-09-26 11:41:29 (EDT)
committer Stephan Born2012-09-26 11:41:29 (EDT)
commit0c5749a35b9ab54cef02a346ca1bfd49ca320386 (patch)
treed32722f562c710d060ec03f3f1470b452a9e2555
parente2bed366556742737726a8d5244f87eccb5cd4dd (diff)
downloadorg.eclipse.stardust.ui.web-0c5749a35b9ab54cef02a346ca1bfd49ca320386.zip
org.eclipse.stardust.ui.web-0c5749a35b9ab54cef02a346ca1bfd49ca320386.tar.gz
org.eclipse.stardust.ui.web-0c5749a35b9ab54cef02a346ca1bfd49ca320386.tar.bz2
CRNT-26376
Made changes to logic of findPath in m_connection.js git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@59531 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_connection.js176
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_diagram.js7
2 files changed, 169 insertions, 14 deletions
diff --git a/web-modeler/src/main/resources/META-INF/xhtml/js/m_connection.js b/web-modeler/src/main/resources/META-INF/xhtml/js/m_connection.js
index cc76bff..f7d7f78 100644
--- a/web-modeler/src/main/resources/META-INF/xhtml/js/m_connection.js
+++ b/web-modeler/src/main/resources/META-INF/xhtml/js/m_connection.js
@@ -1022,26 +1022,176 @@ define(
if (currentSegment.isHorizontal()) {
if ((currentSegment.fromX < currentSegment.toX && currentSegment.toX < targetX)
|| (currentSegment.fromX > currentSegment.toX && currentSegment.toX > targetX)) {
+ if (this.toAnchorPoint.symbol != null
+ && this.toAnchorPoint.symbol.type != m_constants.SWIMLANE_SYMBOL) {
+ if(n==0){
+ if(currentSegment.toX < targetX){
+ var anchorPointMargin =(this.toAnchorPoint.symbol.x - currentSegment.toX) / 2;
+ currentSegment.toX = currentSegment.toX + anchorPointMargin;
+ }
+ else{
+ var anchorPointMargin = (currentSegment.toX - (this.toAnchorPoint.symbol.x + this.toAnchorPoint.symbol.width))/2
+ currentSegment.toX = currentSegment.toX - anchorPointMargin;
+ }
+ }else if (currentSegment.toY < targetY
+ && targetY + m_constants.CONNECTION_MINIMAL_SEGMENT_LENGTH != this.toAnchorPoint.y) {
+ this.segments
+ .push(currentSegment = new Segment(
+ currentSegment.toX,
+ currentSegment.toY,
+ currentSegment.toX,
+ targetY, currentSegment));
+ }else if (currentSegment.toY > targetY
+ && targetY != this.toAnchorPoint.y) {
+ // Horizontal segment from 3 o'clk to 3'
+ // o'clk
+ this.segments
+ .push(currentSegment = new Segment(
+ currentSegment.toX,
+ currentSegment.toY,
+ currentSegment.toX,
+ targetY
+ - m_constants.CONNECTION_MINIMAL_SEGMENT_LENGTH,
+ currentSegment));
+ }else if ((currentSegment.toX < targetX && targetX > this.toAnchorPoint.x)
+ && (this.toAnchorPoint.symbol != null)) {
+ this.segments
+ .push(currentSegment = new Segment(
+ currentSegment.toX,
+ currentSegment.toY,
+ currentSegment.toX,
+ this.toAnchorPoint.symbol.y
+ - m_constants.CONNECTION_MINIMAL_SEGMENT_LENGTH,
+ currentSegment));
+ } else if ((currentSegment.toX > targetX && targetX < this.toAnchorPoint.x)
+ && (this.toAnchorPoint.symbol != null)) {
+ this.segments
+ .push(currentSegment = new Segment(
+ currentSegment.toX,
+ currentSegment.toY,
+ currentSegment.toX,
+ this.toAnchorPoint.symbol.y
+ - m_constants.CONNECTION_MINIMAL_SEGMENT_LENGTH,
+ currentSegment));
+ }else{
+ currentSegment.toX = targetX;
+ }
+ }else
currentSegment.toX = targetX;
} else {
- this.segments
- .push(currentSegment = new Segment(
- currentSegment.toX,
- currentSegment.toY,
- currentSegment.toX, targetY,
- currentSegment));
+ // connect from 6 O'clk to 12 O'clk, when toX
+ // and TargetX match,
+ // the vertical segment needs modification
+ if (this.toAnchorPoint.symbol != null
+ && (currentSegment.toY > targetY && this.toAnchorPoint.y > targetY)) {
+ if (currentSegment.fromX > currentSegment.toX) {
+ currentSegment.toX = this.toAnchorPoint.symbol.x
+ + this.toAnchorPoint.symbol.width
+ + m_constants.CONNECTION_MINIMAL_SEGMENT_LENGTH;
+ } else
+ currentSegment.toX = this.toAnchorPoint.symbol.x
+ - m_constants.CONNECTION_MINIMAL_SEGMENT_LENGTH;
+ this.segments
+ .push(currentSegment = new Segment(
+ currentSegment.toX,
+ currentSegment.toY,
+ currentSegment.toX,
+ (this.toAnchorPoint.symbol.y - m_constants.CONNECTION_MINIMAL_SEGMENT_LENGTH),
+ currentSegment));
+ }else{
+ this.segments
+ .push(currentSegment = new Segment(
+ currentSegment.toX,
+ currentSegment.toY,
+ currentSegment.toX, targetY,
+ currentSegment));
+ }
}
} else {
if ((currentSegment.fromY < currentSegment.toY && currentSegment.toY < targetY)
|| (currentSegment.fromY > currentSegment.toY && currentSegment.toY > targetY)) {
- currentSegment.toY = targetY;
+ if (this.toAnchorPoint.symbol != null
+ && this.toAnchorPoint.symbol.type != m_constants.SWIMLANE_SYMBOL) {
+ if (n == 0) {
+ if (currentSegment.toY < targetY) {
+ var anchorPointMargin = (this.toAnchorPoint.symbol.y - currentSegment.toY) / 2;
+ currentSegment.toY = currentSegment.toY
+ + anchorPointMargin;
+ } else {
+ var anchorPointMargin = (currentSegment.toY - (this.toAnchorPoint.symbol.y + this.toAnchorPoint.symbol.height)) / 2
+ currentSegment.toY = currentSegment.toY
+ - anchorPointMargin;
+ }
+ } else if (currentSegment.toX > targetX
+ && targetX != this.toAnchorPoint.x) {
+ // the bend location should be midway
+ // between symbols, update current
+ // segment
+ this.segments
+ .push(currentSegment = new Segment(
+ currentSegment.toX,
+ currentSegment.toY,
+ targetX,
+ currentSegment.toY,
+ currentSegment));
+ } else if (currentSegment.toX < targetX
+ && targetX != this.toAnchorPoint.x) {
+ this.segments
+ .push(currentSegment = new Segment(
+ currentSegment.toX,
+ currentSegment.toY,
+ targetX,
+ currentSegment.toY,
+ currentSegment));
+ } else if (currentSegment.toY < targetY
+ && targetY > this.toAnchorPoint.y) {
+ // Intermediate vertical lines,
+ // connecting to 9 O'clk segment
+ this.segments
+ .push(currentSegment = new Segment(
+ currentSegment.toX,
+ currentSegment.toY,
+ this.toAnchorPoint.symbol.x
+ - m_constants.CONNECTION_MINIMAL_SEGMENT_LENGTH,
+ currentSegment.toY,
+ currentSegment));
+ } else if ((currentSegment.toY > targetY && targetY < this.toAnchorPoint.y)
+ && (this.toAnchorPoint.symbol != null)) {
+ // Intermediate vertical lines,
+ // connecting to 12 O'clk segment
+ this.segments
+ .push(currentSegment = new Segment(
+ currentSegment.toX,
+ currentSegment.toY,
+ this.toAnchorPoint.symbol.x
+ + m_constants.CONNECTION_MINIMAL_SEGMENT_LENGTH,
+ currentSegment.toY,
+ currentSegment));
+ } else {
+ currentSegment.toY = targetY;
+ }
+ } else
+ currentSegment.toY = targetY;
} else {
- this.segments
- .push(currentSegment = new Segment(
- currentSegment.toX,
- currentSegment.toY, targetX,
- currentSegment.toY,
- currentSegment));
+ if (this.toAnchorPoint.symbol != null
+ && ((currentSegment.toX < this.fromAnchorPoint.symbol.x) && this.toAnchorPoint.symbol.x
+ + this.toAnchorPoint.symbol.width < targetX)) {
+ this.segments
+ .push(currentSegment = new Segment(
+ currentSegment.toX,
+ currentSegment.toY,
+ this.toAnchorPoint.symbol.x
+ - m_constants.CONNECTION_MINIMAL_SEGMENT_LENGTH,
+ currentSegment.toY,
+ currentSegment));
+ }else{
+ this.segments
+ .push(currentSegment = new Segment(
+ currentSegment.toX,
+ currentSegment.toY, targetX,
+ currentSegment.toY,
+ currentSegment));
+ }
}
}
diff --git a/web-modeler/src/main/resources/META-INF/xhtml/js/m_diagram.js b/web-modeler/src/main/resources/META-INF/xhtml/js/m_diagram.js
index 3c513bd..e7470f3 100644
--- a/web-modeler/src/main/resources/META-INF/xhtml/js/m_diagram.js
+++ b/web-modeler/src/main/resources/META-INF/xhtml/js/m_diagram.js
@@ -1371,6 +1371,7 @@ define(
this.currentConnection = null;
m_messageDisplay.clear();
this.mode = this.NORMAL_MODE;
+ $(".selected-tool").removeClass("selected-tool");
}
};
@@ -1536,7 +1537,11 @@ define(
if (this.currentConnection.validateCreateConnection(
this.currentConnection.fromAnchorPoint,
anchorPoint)) {
- this.currentConnection.updateAnchorPointForSymbol();
+ // When connection created from toolbar, the anchor
+ // point should not change
+ if(!$(".selected-tool").is("#connectorButton")){
+ this.currentConnection.updateAnchorPointForSymbol();
+ }
this.currentConnection
.setSecondAnchorPoint(anchorPoint);
if (!this.currentConnection.isCompleted()) {