summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidharth Singh2012-10-04 05:21:17 (EDT)
committerManik Kishore2012-10-04 05:21:17 (EDT)
commit8956a25d83e17aa775936b9ab09a52e4429aed54 (patch)
treebfed4b85ef765539798e648338ff319c476ce349
parent132a55a00d1bceb9fe9be88e611e08b07a445245 (diff)
downloadorg.eclipse.stardust.ui.web-8956a25d83e17aa775936b9ab09a52e4429aed54.zip
org.eclipse.stardust.ui.web-8956a25d83e17aa775936b9ab09a52e4429aed54.tar.gz
org.eclipse.stardust.ui.web-8956a25d83e17aa775936b9ab09a52e4429aed54.tar.bz2
CRNT-26503
Added code in updateAnchorPointForSymbol to update targetAnchorPoint based on co-ordinates of source,target. Added a call in onGlobalMouseMove of m_diagram.js to updateAnchorPointForSymbol while creating symbol from Flyoutmenu. git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@59752 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_connection.js24
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_diagram.js7
2 files changed, 22 insertions, 9 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 6becb1d..85b3ecf 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
@@ -303,21 +303,29 @@ define(
* needs to be moved to 6 O'clock or 3 O'clock
*/
Connection.prototype.updateAnchorPointForSymbol = function() {
- var orientation = null;
+ var sourceOrientation = null;
+ var targetOrientation = 0;
if (this.fromAnchorPoint.symbol.type == m_constants.GATEWAY_SYMBOL || this.fromAnchorPoint.symbol.type == m_constants.ACTIVITY_SYMBOL) {
var startSymbol = this.fromAnchorPoint.symbol;
var targetSymbol = this.toAnchorPoint.symbol;
if (startSymbol.x > targetSymbol.x + targetSymbol.width) {
// Start Symbol is at right, show arrow at left
- orientation = 3;
+ sourceOrientation = 3;
+ if(startSymbol.y > targetSymbol.y){
+ targetOrientation =1;
+ }
} else if (startSymbol.x + startSymbol.width < targetSymbol.x) {
// Start Symbol is at left, show arrow at right
- orientation = 1;
+ sourceOrientation = 1;
+ if(startSymbol.y > targetSymbol.y){
+ targetOrientation =3;
+ }
} else {
// default orientation is SOUTH for gateway
- orientation = 2;
+ sourceOrientation = 2;
}
- this.fromAnchorPoint = startSymbol.anchorPoints[orientation];
+ this.fromAnchorPoint = startSymbol.anchorPoints[sourceOrientation];
+ this.toAnchorPoint = targetSymbol.anchorPoints[targetOrientation];
}
};
@@ -1265,8 +1273,7 @@ define(
+ this.toAnchorPoint.symbol.width < targetX)) {
// For scenario connecting from 9 o'clk(Symbol 1) to 3 o'clk(symbol2)
if (this.fromAnchorPoint.orientation == 3
- && this.toAnchorPoint.orientation == 1
- && currentSegment.toX > targetX) {
+ && this.toAnchorPoint.orientation == 1) {
this.segments
.push(currentSegment = new Segment(
currentSegment.toX,
@@ -1289,8 +1296,7 @@ define(
&& this.toAnchorPoint.symbol.x > targetX)) {
// For scenario connecting from 3 o'clk(Symbol 1) to 9 o'clk(symbol2)
if (this.fromAnchorPoint.orientation == 1
- && this.toAnchorPoint.orientation == 3
- && currentSegment.toX < targetX) {
+ && this.toAnchorPoint.orientation == 3) {
this.segments
.push(currentSegment = new Segment(
currentSegment.toX,
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 a53e5c6..12b3d25 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
@@ -1017,6 +1017,13 @@ define(
if (this.newSymbol.isPrepared()) {
this.newSymbol.move(x * this.zoomFactor, y
* this.zoomFactor);
+ // When creating symbol from flyoutMenu,
+ // connection anchorPoint should be intellegently
+ // changed
+ if (this.currentConnection != null) {
+ this.currentConnection
+ .updateAnchorPointForSymbol();
+ }
} else {
this.newSymbol.prepare(x * this.zoomFactor, y
* this.zoomFactor);