client/js/foundation/eventmanager/eventmanager.coffee in rsence-pre-3.0.0.1 vs client/js/foundation/eventmanager/eventmanager.coffee in rsence-pre-3.0.0.2

- old
+ new

@@ -460,12 +460,14 @@ HSystem._updateFlexibleRects() ELEM.flush() for _viewId in @_listeners.byEvent.resize _ctrl = @_views[_viewId] _ctrl.resize() if _ctrl.resize? - ELEM.flush() - HSystem._updateFlexibleRects() + setTimeout(-> + ELEM.flush() + HSystem._updateFlexibleRects() + , 100 ) # # Finds the next elem with a view_id attribute _findViewId: (_elem)-> until _elem.view_id? or _elem == document.body _elem = _elem.parentNode @@ -575,20 +577,25 @@ _findNewFocus: (x,y)-> _dragged = @_listeners.dragged # return if _dragged.length != 0 _matchIds = @_findTopmostEnabled( HPoint.new( x, y ), 'contains', null ) _focused = @_listeners.focused - if _matchIds.length == 0 + if _matchIds.length == 0 # blur all previously focused for _focusId in _focused - @blur( @_views[_focusId] ) + _ctrl = @_views[_focusId] + if _ctrl? + @blur( _ctrl ) + _focused.splice( _focused.indexOf(_focusId), 1 ) for _viewId in _matchIds continue if ~_focused.indexOf(_viewId) _ctrl = @_views[_viewId] for _focusId in _focused - @blur( @_views[_focusId] ) + _focusCtrl = @_views[_focusId] + if _focusCtrl? + @blur( _focusCtrl ) _focused.splice( _focused.indexOf(_focusId), 1 ) - # @_debugHighlight(_ctrl) + @_debugHighlight(_ctrl) @focus( _ctrl ) # # Just split to gain namespace: _handleMouseMove: ( x, y )-> @_findNewFocus(x,y) @@ -741,10 +748,10 @@ _dropCtrl.endHover(_ctrl) if _dropCtrl.endHover? _dropCtrl.drop(_ctrl) if _dropCtrl.drop? [ x, y ] = @status.crsr _ctrl.endDrag( x, y ) _active.splice( _idx, 1 ) - @blur(_ctrl) if ~_focused.indexOf(_viewId) + @blur(_ctrl) if ~_focused.indexOf(_viewId) and _ctrl? _ctrl.lostActiveStatus(_newActive) _prevActive # # Adds the active control addActiveControl: (_ctrl,_prevActive)->