client/js/foundation/eventmanager/eventmanager.coffee in rsence-pre-3.0.0.5 vs client/js/foundation/eventmanager/eventmanager.coffee in rsence-pre-3.0.0.6
- old
+ new
@@ -782,10 +782,44 @@
# Cancels text selections, which happen by
_cancelTextSelection: ->
# Remove possible selections.
ELEM.get(0).focus()
#
+ # Patches IE classes that match css :active with .ieActive classes
+ _ieClassNamePatched: []
+ _ieClassNamePatch: (_viewId)->
+ _elemId = @_views[_viewId].elemId
+ _elem = ELEM.get( _elemId )
+ _ieClassNamePatched = @_ieClassNamePatched
+ _ieClassNames = HThemeManager._ieActiveCssClassMatch
+ _hasClassName = (_elem,_className)->
+ ~_elem.className.split(' ').indexOf(_className)
+ _addClassName = (_elem)->
+ _classNames = _elem.className.trim().split(' ')
+ _classNames.push('ieActive')
+ _elem.className = _classNames.join(' ')
+ _ieClassNamePatched.push(_elem)
+ _level = 0
+ _patcher = (_elem)->
+ return if _level > 10
+ for _child in _elem.childNodes
+ for _className in _ieClassNames
+ _addClassName(_elem) if _hasClassName(_elem,_className) and not _hasClassName(_elem,'ieActive')
+ _level += 1
+ _patcher(_child)
+ _level -= 1
+ _patcher(_elem)
+ _ieClassNameUnPatch: ->
+ _ieClassNamePatched = @_ieClassNamePatched
+ @_ieClassNamePatched = []
+ _delClassName = (_elem)->
+ _classNames = _elem.className.split(' ')
+ _classNames.splice( _classNames.indexOf( 'ieActive' ), 1 )
+ _elem.className = _classNames.join(' ')
+ for _elem in _ieClassNamePatched
+ _delClassName(_elem)
+ #
# Mouse button press manager. Triggered by the global mouseDown event.
# Delegates the following event responder methods to active HControl instances:
# - mouseDown
# - startDrag
mouseDown: (e)->
@@ -823,10 +857,13 @@
unless ~_dragged.indexOf( _viewId )
_ctrl = @_views[_viewId]
_dragged.unshift( _viewId )
_stop = true if _ctrl.startDrag( x, y, _leftClick )
@_cancelTextSelection() unless _startDragIds.length == 0 and _mouseDownIds.length == 0
+ if BROWSER_TYPE.ie
+ for _viewId in _focused
+ @_ieClassNamePatch(_viewId)
Event.stop(e) if _stop
#
# Mouse button press manager. Triggered by the global mouseDown event.
# Delegates the following event responder methods to active HControl instances:
# - mouseUp
@@ -875,10 +912,11 @@
_ctrl = @_views[_viewId]
@changeActiveControl( _ctrl )
@_listeners.hovered = []
@_listeners.dragged = []
@_cancelTextSelection() unless _endDragIds.length == 0 and _mouseUpIds.length == 0
+ @_ieClassNameUnPatch() if BROWSER_TYPE.ie and @_ieClassNamePatched.length
Event.stop(e) if _stop
#
# Handles mouse button clicks
# It's different from mouseUp/mouseDown, because it's a different event,
# and is supported by touch screen devices
@@ -1080,14 +1118,19 @@
return true if _ctrl[_methodName]? and _ctrl[_methodName]()
else # first special rules, check same
return null unless @_listeners.active
_ctrl = @_views[@_listeners.active[0]]
return true if _ctrl[_methodName]? and _ctrl[_methodName]()
+ _stop = null
for _viewId in _ctrl.parent.views
continue if _ctrl.viewId == _viewId
_ctrl = @_views[_viewId]
if _ctrl[_methodName]?
- return true if _ctrl[_methodName]()
+ _stopStatus = _ctrl[_methodName]()
+ if _stopStatus == false or _stopStatus == true
+ _stop = _stopStatus unless _stop
+ if _stop != null
+ return _stop
if _ctrl.parent?
return true if @defaultKey(_methodName,_ctrl.parent)
return null
#
# Handles the keyDown event