js/foundation/eventmanager/eventmanager.coffee in rsence-pre-2.3.0.24 vs js/foundation/eventmanager/eventmanager.coffee in rsence-pre-2.3.0.25

- old
+ new

@@ -416,11 +416,11 @@ _elem = ELEM.get( _ctrl.elemId ) @observe( _elem, 'mouseover', '_mouseOver' ) [ x, y ] = @status.crsr _matchIds = @_findTopmostEnabled( HPoint.new( x, y ), 'contains', null ) if ~_matchIds.indexOf( _viewId ) - @focus( _ctrl ) + @changeActiveControl( _ctrl ) # # Releases bindings done by #_setEventOptions _unsetEventOptions: (_ctrl,_warnMethodName)-> _warnMethodName = '[unknown]' unless _warnMethodName _viewId = _ctrl.viewId @@ -454,11 +454,13 @@ _wasFocused = true else if _statusItem == 'enabled' unless _wasFocused @stopObserving( _elem, 'mouseover', '_mouseOver' ) _ctrl.setEnabled( false ) if _ctrl.enabled - @_listeners[_statusItem].splice(_viewIdx,1) + _viewIdx = @_listeners[_statusItem].indexOf(_viewId) + if ~_viewIdx + @_listeners[_statusItem].splice(_viewIdx,1) # # Registers the HControl -derived object _ctrl by event listener flags # in _eventOptions. reg: (_ctrl, _eventOptions)-> return false unless @_ensureValidControl( _ctrl, 'reg' ) @@ -731,42 +733,33 @@ continue if _newActive != null and _viewId == _newActive.viewId _ctrl = @_views[_viewId] _ctrl.active = false _idx = _active.indexOf( _viewId ) _dragIdx = _dragged.indexOf(_viewId) - # console.log('dragIdx:',~_dragIdx) if ~_dragIdx _dragged.splice( _dragIdx, 1 ) for _dropViewId in _hovered _dropCtrl = @_views[_dropViewId] _dropCtrl.endHover(_ctrl) if _dropCtrl.endHover? _dropCtrl.drop(_ctrl) if _dropCtrl.drop? [ x, y ] = @status.crsr _ctrl.endDrag( x, y ) _active.splice( _idx, 1 ) - # console.log('lost:',_viewId) @blur(_ctrl) if ~_focused.indexOf(_viewId) _ctrl.lostActiveStatus(_newActive) - # _ctrl.setStyle('border','1px dotted red') - # if @prevActiveCtrl - # @prevActiveCtrl.setStyle('border','1px dotted gray') - # @prevActiveCtrl = null - # @prevActiveCtrl = _ctrl _prevActive # # Adds the active control addActiveControl: (_ctrl,_prevActive)-> _active = @_listeners.active _focused = @_listeners.focused _idx = _active.indexOf( _ctrl.viewId ) unless ~_idx _active.unshift(_ctrl.viewId) - # console.log('gained:',_ctrl.viewId) @focus(_ctrl) unless ~_focused.indexOf(_ctrl.viewId) _ctrl.active = true _ctrl.gainedActiveStatus(_prevActive) - # _ctrl.setStyle('border','1px dotted blue') # # Sets the active control changeActiveControl: (_ctrl)-> _prevActive = @delActiveControl(_ctrl) @addActiveControl(_ctrl, _prevActive) if _ctrl != null @@ -948,17 +941,15 @@ @_handleMouseMove(x,y) _focused = @_listeners.focused _doubleClicks = [] _doubleClickable = @_listeners.byEvent.doubleClick _stop = false - # console.log('focused:',_focused) for _viewId in _focused if ~_doubleClickable.indexOf(_viewId) _doubleClicks.push( _viewId ) for _viewId in _doubleClicks _ctrl = @_views[_viewId] if _ctrl.doubleClick? - # console.log _ctrl.componentName _stop = true if _ctrl.doubleClick(x,y,true) Event.stop(e) if _stop # # Handles mouseWheel events (any HID scroll event) mouseWheel: (e)->