js/foundation/eventmanager/eventmanager.js in rsence-2.1.7 vs js/foundation/eventmanager/eventmanager.js in rsence-2.1.8
- old
+ new
@@ -26,11 +26,12 @@
keyDown: false,
keyUp: false,
mouseWheel: false,
resize: false,
textEnter: false,
- doubleClick: false
+ doubleClick: false,
+ contextMenu: false
},
/** = Description
* Array that keeps the last known global event status type.
*
@@ -839,18 +840,17 @@
* - doubleClick
*
**/
doubleClick: function(e) {
var _this = EVENT,
- _didEndDrag = false,
x = _this.status[_this.crsrX],
y = _this.status[_this.crsrY],
_elemId,
_ctrl,
i = 0;
_this._modifiers(e);
- // Check for mouseUp listeners.
+ // Check for doubleClick listeners.
for (i = 0; i !== _this.focused.length; i++) {
if (_this.focused[i] === true) {
if (_this.focusOptions[i].doubleClick === true) {
_this.focusOptions[i].ctrl.doubleClick(x, y, true);
}
@@ -888,23 +888,41 @@
}
}
}
},
- /* Alternative right button detection, wrapper for the mouseDown method */
+/** Mid-level context menu manager.
+ * Gets called on the onContextMenu event.
+ * Delegates the following call to the high-level event receivers of all
+ * enabled controls registered, depending on the events they registered:
+ * - contextMenu
+ *
+ * Just make a component return true to allow the browser's default action.
+ *
+ **/
contextMenu: function(e) {
- // EVENT.mouseDown(e, false);
- Event.stop(e);
-
- /***
-
- IMPLEMENT SEPARATE CONTEXT-MENU EVENT HANDLING HERE
-
- ***/
-
- // if(Event.isLeftClick(e)){
- // EVENT.status[EVENT.button2] = false;
- // }
+ var _this = EVENT,
+ x = _this.status[_this.crsrX],
+ y = _this.status[_this.crsrY],
+ _preventDefault = true,
+ _elemId,
+ _ctrl,
+ i = 0;
+ _this._modifiers(e);
+ // Check for contextMenu listeners.
+ for (i = 0; i !== _this.focused.length; i++) {
+ if (_this.focused[i] === true) {
+ if (_this.focusOptions[i].contextMenu === true) {
+ if( _this.focusOptions[i].ctrl.contextMenu() ){
+ _preventDefault = false;
+ }
+ }
+ }
+ }
+ if( _preventDefault ){
+ Event.stop( e );
+ }
+ return true;
},
/** Mid-level key press manager.
* Gets called on the onKeyDown event.