client/js/foundation/eventmanager/eventmanager.coffee in rsence-pre-3.0.0.9 vs client/js/foundation/eventmanager/eventmanager.coffee in rsence-pre-3.0.0.10
- old
+ new
@@ -773,10 +773,11 @@
_ctrl.active = true
_ctrl.gainedActiveStatus(_prevActive)
#
# Sets the active control
changeActiveControl: (_ctrl)->
+ return if _ctrl != null and @_views[@_listeners.active[0]] == _ctrl
_prevActive = @delActiveControl(_ctrl)
@addActiveControl(_ctrl, _prevActive) if _ctrl != null
#
# Method to be called, when you want to make an item draggable from outside of the EventManager
startDragging: (_ctrl)->
@@ -1121,25 +1122,29 @@
#
# Traverses down the parent hierarchy searching for a parent object
# that responds true to _methodName. If _ctrl is undefined, use
# a special default rule of auto-selecting the active control and
# checking all of its siblings before traversing.
- defaultKey: (_methodName,_ctrl)->
+ defaultKey: (_methodName,_ctrl,_testedIds)->
return true if _ctrl? and _ctrl[_methodName]? and _ctrl[_methodName]() == true
return null unless @_listeners.active
- _ctrl = @_views[@_listeners.active[0]]
+ _ctrl = @_views[@_listeners.active[0]] unless _ctrl?
+ _ctrlId = _ctrl.viewId
+ return null if ~_testedIds.indexOf(_ctrlId)
return true if _ctrl[_methodName]? and _ctrl[_methodName]() == true
_stop = null
+ _testedIds.push(_ctrlId)
for _viewId in _ctrl.parent.views
+ continue if ~_testedIds.indexOf(_viewId)
continue if _ctrl.viewId == _viewId
_ctrl = @_views[_viewId]
if _ctrl[_methodName]?
_stopStatus = _ctrl[_methodName]()
if _stopStatus == false or _stopStatus == true
_stop = _stopStatus unless _stop
return _stop if _stop != null
- return true if _ctrl.parent? and @defaultKey(_methodName,_ctrl.parent) == true
+ return true if _ctrl.parent? and @defaultKey(_methodName,_ctrl.parent,_testedIds) == true
null
#
# Handles the keyDown event
keyDown: (e)->
@_modifiers(e)
@@ -1166,10 +1171,10 @@
# Some keys are special (esc and return) and they have their own
# special events: defaultKey and escKey, which aren't limited
# to instances of HControl, but any parent object will work.
if not _repeating and @_defaultKeyActions[_keyCode.toString()]
_defaultKeyMethod = @_defaultKeyActions[_keyCode.toString()]
- _stop = true if @defaultKey(_defaultKeyMethod)
+ _stop = true if @defaultKey(_defaultKeyMethod,null,[])
@_lastKeyDown = _keyCode
Event.stop(e) if _stop
keyUp: (e)->
@_modifiers(e)
_keyCode = @translateKeyCodes( e.keyCode )