summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidharth Singh2012-09-20 02:05:28 (EDT)
committer Stephan Born2012-09-20 02:05:28 (EDT)
commit40f35cfbf5d87dbbba01488119775b9ecc3d911f (patch)
tree52ac1356a22176289a4c1637b805e2e98592301d
parentc19efb4cc6bad91446e7be8369f61d1d9641b3d8 (diff)
downloadorg.eclipse.stardust.ui.web-40f35cfbf5d87dbbba01488119775b9ecc3d911f.zip
org.eclipse.stardust.ui.web-40f35cfbf5d87dbbba01488119775b9ecc3d911f.tar.gz
org.eclipse.stardust.ui.web-40f35cfbf5d87dbbba01488119775b9ecc3d911f.tar.bz2
CRNT-26159
Added method validateProximity in m_symbol.js to check if symbol is within proximity margin Added variable currentFlyOutMenuSymbol in m_diagram.js Added code to set currentFlyOutMenuSymbol while activation of flyout menu. git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@59381 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_diagram.js1
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_drawable.js20
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_symbol.js64
3 files changed, 81 insertions, 4 deletions
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 9b83284..aef79d6 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
@@ -94,6 +94,7 @@ define(
this.currentSelection = [];
this.currentConnection = null;
this.newSymbol = null;
+ this.currentFlyOutSymbol = null;
// Caches the last newly created Symbol for server callbacks
this.newSymbol = null;
this.animationDelay = 0;
diff --git a/web-modeler/src/main/resources/META-INF/xhtml/js/m_drawable.js b/web-modeler/src/main/resources/META-INF/xhtml/js/m_drawable.js
index 495a08d..991e922 100644
--- a/web-modeler/src/main/resources/META-INF/xhtml/js/m_drawable.js
+++ b/web-modeler/src/main/resources/META-INF/xhtml/js/m_drawable.js
@@ -278,6 +278,10 @@ define(
*
*/
Drawable.prototype.showFlyOutMenu = function() {
+ if (this.diagram.currentFlyOutSymbol) {
+ return;
+ }
+ this.diagram.currentFlyOutSymbol = this;
this.flyOutMenuBackground.show();
this.flyOutMenuBackground.animate({
"fill-opacity" : FLY_OUT_MENU_END_OPACITY
@@ -361,6 +365,11 @@ define(
++n;
}
+ if (this.diagram.currentFlyOutSymbol
+ && this.diagram.currentFlyOutSymbol.oid == this.oid) {
+ this.diagram.currentFlyOutSymbol = null;
+ }
+
};
/**
@@ -488,6 +497,10 @@ define(
++n;
}
+ if (this.diagram.currentFlyOutSymbol
+ && this.diagram.currentFlyOutSymbol.oid == this.oid) {
+ this.diagram.currentFlyOutSymbol = null;
+ }
};
/**
@@ -648,6 +661,13 @@ define(
"fill" : "white",
"fill-opacity" : 1
});
+ if (this.auxiliaryProperties.callbackScope.type != null) {
+ // check if mouse cursor is outside proximity margin
+ if (this.auxiliaryProperties.callbackScope
+ .validateProximity(event)) {
+ return;
+ }
+ }
this.auxiliaryProperties.callbackScope.hideFlyOutMenu(event);
}
diff --git a/web-modeler/src/main/resources/META-INF/xhtml/js/m_symbol.js b/web-modeler/src/main/resources/META-INF/xhtml/js/m_symbol.js
index 5777b44..0a6969c 100644
--- a/web-modeler/src/main/resources/META-INF/xhtml/js/m_symbol.js
+++ b/web-modeler/src/main/resources/META-INF/xhtml/js/m_symbol.js
@@ -995,15 +995,66 @@ define(
/**
*
*/
- Symbol.prototype.proximityHoverOut = function() {
+ Symbol.prototype.proximityHoverOut = function(event) {
if (this.diagram.mode == this.diagram.NORMAL_MODE) {
- this.hideFlyOutMenu();
+ // Hide flyout menu if mouse cursor is outside proximity of symbol
+ if (!this.validateProximity(event)) {
+ this.hideFlyOutMenu();
+ }
+
} else {
this.hideAnchorPoints();
}
};
/**
+ * Checks if mouse cursor is inside proximity range of symbol
+ */
+ Symbol.prototype.validateProximity = function(event) {
+ try {
+ // while in connection mode/or symbol is Pool/swimlane ,
+ // flyout menu can disappear
+ if ((this.diagram.mode == this.diagram.CONNECTION_MODE || this.diagram.currentConnection != null)
+ || this.type == null
+ || (this.type && (this.type == m_constants.POOL_SYMBOL || this.type == m_constants.SWIMLANE_SYMBOL))) {
+ return false;
+ }
+
+ var scrollPos = m_modelerUtils
+ .getModelerScrollPosition();
+ var xPos = event.pageX - this.diagram.X_OFFSET
+ + scrollPos.left;
+ var yPos = event.pageY - this.diagram.Y_OFFSET
+ + scrollPos.top;
+
+ var proximityMargin = m_constants.PROXIMITY_SENSOR_MARGIN;
+ // symbol x co-ord , width and proximity width will give
+ // the right proximity margin
+ var rightProximityMargin = this.x + this.width
+ + proximityMargin + scrollPos.left;
+ // symbol x co-ord minus proximity width will give the
+ // left proximity margin
+ var leftProximityMargin = this.x - proximityMargin;
+ // symbol y co-ord minus proximity width will
+ // give the top proximity margin
+ var topProximityMargin = this.y - proximityMargin;
+ // symbol y co-ord , height,proximity width will give
+ // the bottom proximity margin
+ var bottomProximityMargin = this.y + this.height
+ + proximityMargin;
+
+ if ((xPos <= rightProximityMargin && xPos >= leftProximityMargin)
+ && (yPos <= bottomProximityMargin && yPos >= topProximityMargin)) {
+ return true;
+ }
+
+ } catch (e) {
+ return false;
+ }
+ return false;
+ };
+
+ /**
*
*/
Symbol.prototype.addToPrimitives = function(element) {
@@ -1471,8 +1522,13 @@ define(
/**
*
*/
- function Symbol_hoverOutFlyOutMenuClosure() {
- this.auxiliaryProperties.callbackScope.hideFlyOutMenu();
+ function Symbol_hoverOutFlyOutMenuClosure(event) {
+ // Hover out(hide flyout menu) if mouse cursor is outside
+ // proximity of symbol
+ if (!this.auxiliaryProperties.callbackScope
+ .validateProximity(event)) {
+ this.auxiliaryProperties.callbackScope.hideFlyOutMenu();
+ }
}
/**