rsence-pre 2.3.0.1 → 2.3.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -122,14 +122,14 @@ EventManagerApp = HApplication.extend
122
122
  4: []
123
123
  keysDown: []
124
124
  hasKeyDown: (k)->
125
- @keysDown.indexOf(k) != -1
125
+ !!~@keysDown.indexOf(k)
126
126
  addKeyDown: (k)->
127
127
  if !@hasKeyDown(k)
128
128
  @keysDown.push( k )
129
129
  @[4] = @keysDown
130
130
  delKeyDown: (k)->
131
131
  i = @keysDown.indexOf(k)
132
- if i != -1
132
+ if ~i
133
133
  @keysDown.splice( i, 1 )
134
134
  @[4] = @keysDown
135
135
  resetKeysDown: ->
@@ -199,8 +199,8 @@ EventManagerApp = HApplication.extend
199
199
  #
200
200
  # List of used event methods for global purposes:
201
201
  _eventMethods: [
202
- 'mouseMove', 'mouseUp', 'mouseDown', 'click', 'keyUp', 'keyDown',
203
- 'contextMenu', 'resize', 'mouseWheel', 'doubleClick'
202
+ 'resize', 'mouseMove', 'doubleClick', 'contextMenu', 'click', 'mouseUp',
203
+ 'mouseDown', 'keyUp', 'keyDown', 'mouseWheel'
204
204
  ]
205
205
  #
206
206
  # This structure keeps track of registered elem/event/object/method; see #observe and #stopObserving
@@ -220,7 +220,7 @@ EventManagerApp = HApplication.extend
220
220
  }
221
221
  _cache = @_observerMethods[_eventName]
222
222
  _elemIdx = _cache.elems.indexOf( _elem )
223
- if _elemIdx != -1
223
+ if ~_elemIdx
224
224
  _prevFn = _cache.fns[_elemIdx]
225
225
  _prevCapture = _cache.capture[_elemIdx]
226
226
  Event.stopObserving( _elem, _eventName, _prevFn, _prevCapture )
@@ -241,7 +241,7 @@ EventManagerApp = HApplication.extend
241
241
  return false
242
242
  _cache = @_observerMethods[_eventName]
243
243
  _elemIdx = _cache.elems.indexOf(_elem)
244
- return false if _elemIdx == -1
244
+ return false unless ~_elemIdx
245
245
  _prevFn = _cache.fns[_elemIdx]
246
246
  _prevCapture = _cache.capture[_elemIdx]
247
247
  Event.stopObserving( _elem, _eventName, _prevFn, _prevCapture )
@@ -402,19 +402,18 @@ EventManagerApp = HApplication.extend
402
402
  _value = _eventOptions[_key]
403
403
  if _value
404
404
  _eventsOn.push( _key )
405
- @_listeners.byEvent[_key].unshift( _viewId ) if @_listeners.byEvent[_key].indexOf(_viewId) == -1
406
- if _key == 'rectHover' and _value == 'intersects' and @_listeners._rectHoverIntersectMode.indexOf( _viewId ) == -1
405
+ @_listeners.byEvent[_key].unshift( _viewId ) unless ~@_listeners.byEvent[_key].indexOf(_viewId)
406
+ if _key == 'rectHover' and _value == 'intersects' and not ~@_listeners._rectHoverIntersectMode.indexOf( _viewId )
407
407
  @_listeners._rectHoverIntersectMode.unshift( _viewId )
408
408
  else
409
409
  _idx = @_listeners.byEvent[_key].indexOf(_viewId)
410
- if _idx != -1
411
- @_listeners.byEvent[_key].splice( _idx, 1 )
410
+ @_listeners.byEvent[_key].splice( _idx, 1 ) if ~_idx
412
411
  else
413
412
  @warn( "EventManager##{_warnMethodName} => Invalid event type: #{_key}" )
414
413
  _this = @
415
414
  @_listeners.byId[_viewId] = _eventsOn
416
415
  if _ctrl.enabled
417
- @_listeners.enabled.unshift( _viewId ) if @_listeners.enabled.indexOf(_viewId) == -1
416
+ @_listeners.enabled.unshift( _viewId ) unless ~@_listeners.enabled.indexOf(_viewId)
418
417
  _elem = ELEM.get( _ctrl.elemId )
419
418
  @observe( _elem, 'mouseover', '_mouseOver' )
420
419
  #
@@ -426,20 +425,18 @@ EventManagerApp = HApplication.extend
426
425
  delete @_listeners.byId[_viewId]
427
426
  else
428
427
  @warn( "EventManager##{_warnMethodName} => viewId not registered: #{_viewId}" )
429
- console.log(@_listeners.byId[_viewId],_viewId,_ctrl)
430
428
  for _key, _value of @_listeners.byEvent
431
429
  _viewIdx = _value.indexOf(_viewId)
432
- if _viewIdx != -1
433
- _value.splice(_viewIdx,1)
430
+ _value.splice(_viewIdx,1) if ~_viewIdx
434
431
  if _key == 'rectHover'
435
432
  _intersectHoverIdx = @_listeners._rectHoverIntersectMode.indexOf( _viewId )
436
- if _intersectHoverIdx != -1
433
+ if ~_intersectHoverIdx
437
434
  @_listeners._rectHoverIntersectMode.splice( _intersectHoverIdx, 1 )
438
435
  _wasFocused = false
439
436
  _elem = ELEM.get( _ctrl.elemId )
440
437
  for _statusItem in [ 'dragged', 'selected', 'hovered', 'active', 'focused', 'enabled' ]
441
438
  _viewIdx = @_listeners[_statusItem].indexOf(_viewId)
442
- if _viewIdx != -1
439
+ if ~_viewIdx
443
440
  if _statusItem == 'dragged'
444
441
  _ctrl.endDrag( @status.crsrX, @status.crsrY )
445
442
  else if _statusItem == 'selected'
@@ -552,7 +549,7 @@ EventManagerApp = HApplication.extend
552
549
  # mouseover event.
553
550
  focus: (_ctrl)->
554
551
  _viewId = _ctrl.viewId
555
- if @_listeners.focused.indexOf(_viewId) == -1
552
+ unless ~@_listeners.focused.indexOf(_viewId)
556
553
  _elem = ELEM.get( _ctrl.elemId )
557
554
  @observe( _elem, 'mouseout', '_mouseOut' )
558
555
  @stopObserving( _elem, 'mouseover', '_mouseOver' )
@@ -567,7 +564,7 @@ EventManagerApp = HApplication.extend
567
564
  blur: (_ctrl)->
568
565
  _viewId = _ctrl.viewId
569
566
  _viewIdx = @_listeners.focused.indexOf(_viewId)
570
- if _viewIdx != -1
567
+ if ~_viewIdx
571
568
  _elem = ELEM.get( _ctrl.elemId )
572
569
  @observe( _elem, 'mouseover', '_mouseOver' )
573
570
  @stopObserving( _elem, 'mouseout', '_mouseOut' )
@@ -621,8 +618,8 @@ EventManagerApp = HApplication.extend
621
618
  # #hover( _dragObj ) and #endHover( _dragObj ) calls
622
619
  _delegateHover: (_ctrl, x, y)->
623
620
  _byEvent = @_listeners.byEvent
624
- _findPoint = _byEvent.rectHover.indexOf( _ctrl.viewId ) == -1
625
- _findTopmost = _byEvent.multiDrop.indexOf( _ctrl.viewId ) == -1
621
+ _findPoint = not ~_byEvent.rectHover.indexOf( _ctrl.viewId )
622
+ _findTopmost = not ~_byEvent.multiDrop.indexOf( _ctrl.viewId )
626
623
  _findIntersect = true
627
624
  if _findPoint
628
625
  _area = HPoint.new( x, y )
@@ -630,7 +627,7 @@ EventManagerApp = HApplication.extend
630
627
  else
631
628
  _rect = _ctrl.rect
632
629
  _area = HRect.new( x, y, _rect.width, _rect.height )
633
- if @_listeners._rectHoverIntersectMode.indexOf( _viewId ) == -1
630
+ if not ~@_listeners._rectHoverIntersectMode.indexOf( _viewId )
634
631
  _matchMethod = 'intersects'
635
632
  else
636
633
  _matchMethod = 'contains'
@@ -640,11 +637,11 @@ EventManagerApp = HApplication.extend
640
637
  _hoverItems = @_findAllDroppable(_area,_matchMethod,_ctrl.viewid)
641
638
  _endHover = []
642
639
  for _hoverId in @_listeners.hovered
643
- if _hoverItems.indexOf( _hoverId ) == -1
640
+ unless ~_hoverItems.indexOf( _hoverId )
644
641
  _endHover.push( _hoverId )
645
642
  _startHover = []
646
643
  for _hoverId in _hoverItems
647
- if @_listeners.hovered.indexOf( _hoverId ) == -1
644
+ unless ~@_listeners.hovered.indexOf( _hoverId )
648
645
  _startHover.push( _hoverId )
649
646
  for _viewId in _startHover
650
647
  @_views[_viewId].startHover(_ctrl)
@@ -662,8 +659,15 @@ EventManagerApp = HApplication.extend
662
659
  for _viewId in _parentIds
663
660
  continue if _viewId == _selfId
664
661
  _view = _views[_viewId]
665
- if _view.hasAncestor? and _view.hasAncestor( HView ) and _view.rect[_matchMethod](_area)
666
- if _droppable.indexOf( _viewId ) != -1
662
+ if _view.parent.hasAncestor( HView )
663
+ if _area.offsetTo?
664
+ _searchArea = HRect.nu(_area).offsetTo( _area.left-_view.parent.pageX(), _area.top-_view.parent.pageY() )
665
+ else
666
+ _searchArea = HPoint.nu( _area.x-_view.parent.pageX(), _area.y-_view.parent.pageY() )
667
+ else
668
+ _searchArea = _area
669
+ if _view.hasAncestor? and _view.hasAncestor( HView ) and _view.rect[_matchMethod](_searchArea)
670
+ if ~_droppable.indexOf( _viewId )
667
671
  _dropId = _search( _view.viewsZOrder.slice().reverse() )
668
672
  return _dropId if _dropId
669
673
  return _viewId
@@ -684,7 +688,7 @@ EventManagerApp = HApplication.extend
684
688
  continue if _viewId == _selfId
685
689
  _view = _views[_viewId]
686
690
  if _view.hasAncestor? and _view.hasAncestor( HView ) and _view.rect[_matchMethod](_area)
687
- _found.push( _viewId ) if _droppable.indexOf( _viewId ) != -1
691
+ _found.push( _viewId ) if ~_droppable.indexOf( _viewId )
688
692
  _search( _view.viewsZOrder.slice().reverse() )
689
693
  _search( HSystem.viewsZOrder.slice().reverse() )
690
694
  return _found
@@ -693,19 +697,36 @@ EventManagerApp = HApplication.extend
693
697
  delActiveControl: (_newActive)->
694
698
  _active = @_listeners.active
695
699
  _focused = @_listeners.focused
700
+ _dragged = @_listeners.dragged
701
+ _hovered = @_listeners.hovered
696
702
  return null if _active.length == 0
697
- if _active.length == 1
698
- _prevActive = @_views[_active[0]]
699
- else
703
+ _prevActive = @_views[_active[0]]
704
+ if _active.length != 1
700
705
  @warn "Danger, too many active items: #{JSON.stringify(_active)}"
701
706
  for _viewId in _active.slice()
702
707
  continue if _newActive != null and _viewId == _newActive.viewId
703
708
  _ctrl = @_views[_viewId]
704
709
  _ctrl.active = false
705
710
  _idx = _active.indexOf( _viewId )
711
+ _dragIdx = _dragged.indexOf(_viewId)
712
+ # console.log('dragIdx:',~_dragIdx)
713
+ if ~_dragIdx
714
+ _dragged.splice( _dragIdx, 1 )
715
+ for _dropViewId in _hovered
716
+ _dropCtrl = @_views[_dropViewId]
717
+ _dropCtrl.endHover(_ctrl) if _dropCtrl.endHover?
718
+ _dropCtrl.drop(_ctrl) if _dropCtrl.drop?
719
+ [ x, y ] = @status.crsr
720
+ _ctrl.endDrag( x, y )
706
721
  _active.splice( _idx, 1 )
707
- @blur(_ctrl) if _focused.indexOf(_viewId) != -1
722
+ # console.log('lost:',_viewId)
723
+ @blur(_ctrl) if ~_focused.indexOf(_viewId)
708
724
  _ctrl.lostActiveStatus(_newActive)
725
+ # _ctrl.setStyle('border','1px dotted red')
726
+ # if @prevActiveCtrl
727
+ # @prevActiveCtrl.setStyle('border','1px dotted gray')
728
+ # @prevActiveCtrl = null
729
+ # @prevActiveCtrl = _ctrl
709
730
  _prevActive
710
731
  #
711
732
  # Adds the active control
@@ -713,11 +734,13 @@ EventManagerApp = HApplication.extend
713
734
  _active = @_listeners.active
714
735
  _focused = @_listeners.focused
715
736
  _idx = _active.indexOf( _ctrl.viewId )
716
- if _idx == -1
737
+ unless ~_idx
717
738
  _active.unshift(_ctrl.viewId)
718
- @focus(_ctrl) if _focused.indexOf(_ctrl.viewId) == -1
739
+ # console.log('gained:',_ctrl.viewId)
740
+ @focus(_ctrl) unless ~_focused.indexOf(_ctrl.viewId)
719
741
  _ctrl.active = true
720
742
  _ctrl.gainedActiveStatus(_prevActive)
743
+ # _ctrl.setStyle('border','1px dotted blue')
721
744
  #
722
745
  # Sets the active control
723
746
  changeActiveControl: (_ctrl)->
@@ -730,7 +753,7 @@ EventManagerApp = HApplication.extend
730
753
  _viewId = _ctrl.viewId
731
754
  @focus( _viewId )
732
755
  @changeActiveControl(_ctrl)
733
- @_listeners.dragged.unshift( _viewId ) if @_listeners.dragged.indexOf( _viewId ) == -1
756
+ @_listeners.dragged.unshift( _viewId ) unless ~@_listeners.dragged.indexOf( _viewId )
734
757
  _ctrl.startDrag( @status.crsrX, @status.crsrY, @status.button2 )
735
758
  #
736
759
  # Cancels text selections, which happen by
@@ -759,25 +782,25 @@ EventManagerApp = HApplication.extend
759
782
  _startDragIds = []
760
783
  _stop = false
761
784
  for _viewId in _focused
762
- _newActive.push( _viewId ) if _active.indexOf(_viewId) == -1
785
+ _newActive.push( _viewId ) unless ~_active.indexOf(_viewId)
763
786
  _eventOptions = @_listeners.byId[_viewId]
764
- if _mouseDownable.indexOf( _viewId ) != -1
787
+ if ~_mouseDownable.indexOf( _viewId )
765
788
  _mouseDownIds.push( _viewId )
766
- if _draggable.indexOf( _viewId ) != -1 and _dragged.indexOf( _viewId ) == -1
789
+ if ~_draggable.indexOf( _viewId ) and not ~_dragged.indexOf( _viewId )
767
790
  _startDragIds.push( _viewId )
768
791
  for _viewId in _newActive
769
792
  _ctrl = @_views[_viewId]
770
793
  @changeActiveControl( _ctrl )
771
794
  [ x, y ] = @status.crsr
795
+ @_handleMouseMove(x,y)
772
796
  for _viewId in _mouseDownIds
773
797
  _ctrl = @_views[_viewId]
774
798
  _stop = true if _ctrl.mouseDown( x, y, _leftClick )
775
799
  for _viewId in _startDragIds
776
- if _dragged.indexOf( _viewId ) == -1
800
+ unless ~_dragged.indexOf( _viewId )
777
801
  _ctrl = @_views[_viewId]
778
802
  _dragged.unshift( _viewId )
779
803
  _stop = true if _ctrl.startDrag( x, y, _leftClick )
780
- @_handleMouseMove(x,y)
781
804
  @_cancelTextSelection() unless _startDragIds.length == 0 and _mouseDownIds.length == 0
782
805
  Event.stop(e) if _stop
783
806
  #
@@ -804,22 +827,20 @@ EventManagerApp = HApplication.extend
804
827
  _endDragIds = []
805
828
  _stop = false
806
829
  for _viewId in _focused
807
- _newActive.push( _viewId ) if _active.indexOf(_viewId) == -1
830
+ _newActive.push( _viewId ) unless ~_active.indexOf(_viewId)
808
831
  _eventOptions = @_listeners.byId[_viewId]
809
- if _mouseUppable.indexOf( _viewId ) != -1
832
+ if ~_mouseUppable.indexOf( _viewId )
810
833
  _mouseUpIds.push( _viewId )
811
- if _draggable.indexOf( _viewId ) != -1 and _dragged.indexOf( _viewId ) != -1
834
+ if ~_draggable.indexOf( _viewId ) and ~_dragged.indexOf( _viewId )
812
835
  _endDragIds.push( _viewId )
813
- for _viewId in _newActive
814
- _ctrl = @_views[_viewId]
815
- @changeActiveControl( _ctrl )
816
836
  [ x, y ] = @status.crsr
837
+ @_handleMouseMove(x,y)
817
838
  for _viewId in _mouseUpIds
818
839
  _ctrl = @_views[_viewId]
819
840
  _stop = true if _ctrl.mouseUp( x, y, _leftClick )
820
841
  for _viewId in _endDragIds
821
842
  _dragIdx = _dragged.indexOf( _viewId )
822
- unless _dragIdx == -1
843
+ if ~_dragIdx
823
844
  _ctrl = @_views[_viewId]
824
845
  _dragged.splice( _dragIdx, 1 )
825
846
  for _dropViewId in _hovered
@@ -827,9 +848,11 @@ EventManagerApp = HApplication.extend
827
848
  _dropCtrl.endHover(_ctrl) if _dropCtrl.endHover?
828
849
  _dropCtrl.drop(_ctrl) if _dropCtrl.drop?
829
850
  _stop = true if _ctrl.endDrag( x, y, _leftClick )
851
+ for _viewId in _newActive
852
+ _ctrl = @_views[_viewId]
853
+ @changeActiveControl( _ctrl )
830
854
  @_listeners.hovered = []
831
855
  @_listeners.dragged = []
832
- @_handleMouseMove(x,y)
833
856
  @_cancelTextSelection() unless _endDragIds.length == 0 and _mouseUpIds.length == 0
834
857
  Event.stop(e) if _stop
835
858
  ## /jatka
@@ -849,28 +872,47 @@ EventManagerApp = HApplication.extend
849
872
  _focused = @_listeners.focused
850
873
  _active = @_listeners.active
851
874
  _clickable = @_listeners.byEvent.click
875
+ _doubleClickable = @_listeners.byEvent.doubleClick
876
+ _doubleClickWait = []
852
877
  _newActive = []
853
878
  _clickIds = []
854
879
  _stop = false
855
880
  for _viewId in _focused
856
- _newActive.push( _viewId ) if _active.indexOf(_viewId) == -1
857
- if _clickable.indexOf(_viewId) != -1
881
+ _newActive.push( _viewId ) unless ~_active.indexOf(_viewId)
882
+ if ~_clickable.indexOf(_viewId) and ~_doubleClickable.indexOf(_viewId)
883
+ _doubleClickWait.push( _viewId )
884
+ else if ~_clickable.indexOf(_viewId)
858
885
  _clickIds.push( _viewId )
859
886
  for _viewId in _newActive
860
887
  _ctrl = @_views[_viewId]
861
888
  @changeActiveControl( _ctrl )
862
889
  [ x, y ] = @status.crsr
890
+ @_handleMouseMove(x,y)
863
891
  for _viewId in _clickIds
864
892
  _ctrl = @_views[_viewId]
865
893
  unless _ctrl.click? and typeof _ctrl.click == 'function'
866
894
  @warn( 'no click:', _ctrl, _ctrl.click?, typeof _ctrl.click )
867
895
  continue
868
896
  _stop = true if _ctrl.click( x, y, _leftClick )
869
- @_handleMouseMove(x,y)
897
+ if _doubleClickWait.length
898
+ _this = @
899
+ @dblClickWait = setTimeout( (->
900
+ for _viewId in _doubleClickWait
901
+ _ctrl = _this._views[_viewId]
902
+ unless _ctrl.click? and typeof _ctrl.click == 'function'
903
+ _this.warn( 'no click:', _ctrl, _ctrl.click?, typeof _ctrl.click )
904
+ continue
905
+ _stop = true if _ctrl.click( x, y, _leftClick )
906
+ Event.stop(e) if _stop
907
+ ), 50
908
+ )
870
909
  Event.stop(e) if _stop
871
910
  #
872
911
  # Handles doubleClick events
873
912
  doubleClick: (e)->
913
+ if @dblClickWait
914
+ clearTimeout( @dblClickWait )
915
+ delete this['dblClickWait']
874
916
  @_modifiers(e)
875
917
  _leftClick = Event.isLeftClick(e)
876
918
  @status.setButton1( false )
@@ -881,12 +923,14 @@ EventManagerApp = HApplication.extend
881
923
  _doubleClicks = []
882
924
  _doubleClickable = @_listeners.byEvent.doubleClick
883
925
  _stop = false
926
+ # console.log('focused:',_focused)
884
927
  for _viewId in _focused
885
- if _doubleClickable.indexOf(_viewId) != -1
928
+ if ~_doubleClickable.indexOf(_viewId)
886
929
  _doubleClicks.push( _viewId )
887
- for _viewId in _doubleClickable
930
+ for _viewId in _doubleClicks
888
931
  _ctrl = @_views[_viewId]
889
932
  if _ctrl.doubleClick?
933
+ # console.log _ctrl.componentName
890
934
  _stop = true if _ctrl.doubleClick(x,y,true)
891
935
  Event.stop(e) if _stop
892
936
  #
@@ -905,7 +949,7 @@ EventManagerApp = HApplication.extend
905
949
  _mouseWheelable = @_listeners.byEvent.mouseWheel
906
950
  _stop = false
907
951
  for _viewId in _focused
908
- if _mouseWheelable.indexOf(_viewId) != -1
952
+ if ~_mouseWheelable.indexOf(_viewId)
909
953
  _mouseWheels.push( _viewId )
910
954
  for _viewId in _mouseWheels
911
955
  _ctrl = @_views[_viewId]
@@ -922,7 +966,7 @@ EventManagerApp = HApplication.extend
922
966
  _focused = @_listeners.focused
923
967
  _contextMenuable = @_listeners.byEvent.contextMenu
924
968
  for _viewId in _focused
925
- if _contextMenuable.indexOf(_viewId) != -1
969
+ if ~_contextMenuable.indexOf(_viewId)
926
970
  _ctrl = @_views[_viewId]
927
971
  _stop = false if _ctrl.contextMenu? and _ctrl.contextMenu()
928
972
  Event.stop(e) if _stop
@@ -990,7 +1034,7 @@ EventManagerApp = HApplication.extend
990
1034
  _detectCmdKey: ( _keyCode )->
991
1035
  # On Opera, return true on any of the keycodes
992
1036
  if BROWSER_TYPE.opera
993
- return @_cmdKeys.indexOf(_keyCode) != -1
1037
+ return !!~@_cmdKeys.indexOf(_keyCode)
994
1038
  # Any mac browser (except opera, above) uses left or right windows key
995
1039
  # equivalent as the Command key.
996
1040
  else if BROWSER_TYPE.mac
@@ -1011,7 +1055,7 @@ EventManagerApp = HApplication.extend
1011
1055
  _keyDowns = []
1012
1056
  unless @status.hasKeyDown( _keyCode ) and @_lastKeyDown != _keyCode
1013
1057
  for _viewId in _active
1014
- _keyDowns.push( _viewId ) if _keyDowners.indexOf( _viewId ) != -1
1058
+ _keyDowns.push( _viewId ) if ~_keyDowners.indexOf( _viewId )
1015
1059
  @status.addKeyDown( _keyCode )
1016
1060
  # repeat not implemented yet
1017
1061
  for _viewId in _keyDowns
@@ -1033,20 +1077,20 @@ EventManagerApp = HApplication.extend
1033
1077
  _keyUps = []
1034
1078
  _textEnterers = @_listeners.byEvent.textEnter
1035
1079
  _textEnters = []
1080
+ for _viewId in _textEnterers
1081
+ _textEnters.push( _viewId ) if ~_enabled.indexOf( _viewId )
1082
+ for _viewId in _textEnters
1083
+ _ctrl = @_views[_viewId]
1084
+ if _ctrl.textEnter?
1085
+ _stop = true if _ctrl.textEnter( _keyCode )
1036
1086
  if @status.hasKeyDown( _keyCode )
1037
1087
  for _viewId in _active
1038
- _keyUps.push( _viewId ) if _keyUppers.indexOf( _viewId ) != -1
1088
+ _keyUps.push( _viewId ) if ~_keyUppers.indexOf( _viewId )
1039
1089
  @status.delKeyDown( _keyCode )
1040
1090
  for _viewId in _keyUppers
1041
1091
  _ctrl = @_views[_viewId]
1042
1092
  if _ctrl.keyUp?
1043
1093
  _stop = true if _ctrl.keyUp( _keyCode )
1044
- for _viewId in _textEnterers
1045
- _textEnters.push( _viewId ) if _enabled.indexOf( _viewId ) != -1
1046
- for _viewId in _textEnters
1047
- _ctrl = @_views[_viewId]
1048
- if _ctrl.textEnter?
1049
- _stop = true if _ctrl.textEnter( _keyCode )
1050
1094
  Event.stop(e) if _stop
1051
1095
  keyPress: (e)->
1052
1096
  @warn('EventManager#keyPress not implemented')
@@ -663,7 +663,7 @@ HRect = HClass.extend({
663
663
  *
664
664
  **/
665
665
  bind: function(_view){
666
- if(this.viewIds.indexOf( _view.viewId ) === -1){
666
+ if(!~this.viewIds.indexOf( _view.viewId )){
667
667
  this.viewIds.push( _view.viewId );
668
668
  }
669
669
  this._updateFlexibleDimensions();
@@ -674,7 +674,7 @@ HRect = HClass.extend({
674
674
  **/
675
675
  release: function(_view){
676
676
  var _viewIdx = this.viewIds.indexOf(_view.viewId);
677
- if(_viewIdx !== -1){
677
+ if(~_viewIdx){
678
678
  this.viewIds.splice( _viewIdx, 1 );
679
679
  }
680
680
  },
@@ -114,7 +114,7 @@ COMM.JSONRenderer = HClass.extend({
114
114
  _extend = HClass;
115
115
  }
116
116
  for( _key in _definition ){
117
- if( _reserved.indexOf( _key ) === -1 ){
117
+ if( !~_reserved.indexOf( _key ) ){
118
118
  _value = _definition[_key];
119
119
  if( typeof _value === 'string' ){
120
120
  _value = this.extEval( _value );
@@ -134,7 +134,7 @@ COMM.JSONRenderer = HClass.extend({
134
134
  if(_className === undefined){
135
135
  return false;
136
136
  }
137
- if(_className.indexOf('.') !== -1){
137
+ if(~_className.indexOf('.')){
138
138
  var
139
139
  _splitClass = _className.split('.'),
140
140
  j = 1,
@@ -219,7 +219,7 @@ COMM.JSONRenderer = HClass.extend({
219
219
  if( !_dataNode['class'] ){
220
220
 
221
221
  for( i in _dataNode ){
222
- if( _reserved.indexOf( i ) === -1 ){
222
+ if( !~_reserved.indexOf( i ) ){
223
223
  _className = i;
224
224
  _origNode = _dataNode;
225
225
  _dataNode = _dataNode[i];
@@ -317,11 +317,11 @@ HSystem = {
317
317
 
318
318
  /** Updates the z-indexes of the children of the given +_viewId+. **/
319
319
  updateZIndexOfChildren: function(_viewId) {
320
- if(this._updateZIndexOfChildrenBuffer.indexOf(_viewId)===-1){
320
+ if(!~this._updateZIndexOfChildrenBuffer.indexOf(_viewId)){
321
321
  this._updateZIndexOfChildrenBuffer.push(_viewId);
322
322
  }
323
323
  if((_viewId !== undefined && _viewId !== null) && (this.views[_viewId].app === this.views[_viewId].parent)){
324
- (this._updateZIndexOfChildrenBuffer.indexOf(null)===-1) && this._updateZIndexOfChildrenBuffer.push(null);
324
+ (!~this._updateZIndexOfChildrenBuffer.indexOf(null)) && this._updateZIndexOfChildrenBuffer.push(null);
325
325
  }
326
326
  },
327
327
 
@@ -138,7 +138,7 @@ HThemeManager = HClass.extend({
138
138
  **/
139
139
  getCssFilePath: function( _fileName ){
140
140
  var _themeName = this._cssEvalParams[0];
141
- if((HThemeHasIE6GifsInsteadOfPng.indexOf(_themeName)!==-1) && (BROWSER_TYPE.ie6 || BROWSER_TYPE.symbian) ){
141
+ if((~HThemeHasIE6GifsInsteadOfPng.indexOf(_themeName)) && (BROWSER_TYPE.ie6 || BROWSER_TYPE.symbian) ){
142
142
  return "url('"+this._joinPath( this.getThemeGfxPath(), _fileName.replace('.png','-ie6.gif') )+"')";
143
143
  }
144
144
  else {
@@ -314,14 +314,14 @@ HThemeManager = HClass.extend({
314
314
  /* Load Theme-Specific CSS: */
315
315
  if(!this._cssCache[_themeName]){
316
316
  this._cssCache[_themeName] = {};
317
- if(HNoCommonCSS.indexOf(_themeName)===-1){
317
+ if(!~HNoCommonCSS.indexOf(_themeName)){
318
318
  var _commonCssUrl = this._cssUrl( _themeName, 'common', _themePath, null );
319
319
  this.loadCSS( _commonCssUrl );
320
320
  }
321
321
  }
322
322
 
323
323
  /* Load Component-Specific CSS, unless configured to only load the common css: */
324
- if(HNoComponentCSS.indexOf(_themeName)===-1){
324
+ if(!~HNoComponentCSS.indexOf(_themeName)){
325
325
  if (!this._cssCache[_themeName][_componentName]){
326
326
  var _componentCssUrl = this._cssUrl( _themeName, _componentName, _themePath );
327
327
  this._cssCache[_themeName][_componentName] = true;
@@ -340,7 +340,7 @@ HThemeManager = HClass.extend({
340
340
  return _url;
341
341
  },
342
342
  _componentGfxFile: function( _themeName, _componentName, _themePath, _fileName ){
343
- if((HThemeHasIE6GifsInsteadOfPng.indexOf(_themeName)!==-1) && BROWSER_TYPE.ie6){
343
+ if((~HThemeHasIE6GifsInsteadOfPng.indexOf(_themeName)) && BROWSER_TYPE.ie6){
344
344
  return this._joinPath( this._componentGfxPath(_themeName, _componentName, _themePath), _fileName.replace('.png','-ie6.gif') );
345
345
  }
346
346
  return this._joinPath( this._componentGfxPath(_themeName, _componentName, _themePath), _fileName );
@@ -133,7 +133,7 @@ HValue = HClass.extend({
133
133
  if(_responder===undefined){
134
134
  throw("HValueBindError: responder is undefined!");
135
135
  }
136
- if(this.views.indexOf(_responder)===-1){
136
+ if(!~this.views.indexOf(_responder)){
137
137
  this.views.push(_responder);
138
138
  _responder.setValueObj( this );
139
139
  }
@@ -783,7 +783,7 @@ HView = HClass.extend({
783
783
  var _partName = this.markupElemNames[ i ],
784
784
  _elemName = _partName + this.elemId,
785
785
  _htmlIdMatch = ' id="' + _elemName + '"';
786
- if( this.markup.indexOf( _htmlIdMatch ) !== -1 ) {
786
+ if( ~this.markup.indexOf( _htmlIdMatch ) ) {
787
787
  this.markupElemIds[ _partName ] = this.bindDomElement( _elemName );
788
788
  }
789
789
  }
@@ -1432,7 +1432,7 @@ HView = HClass.extend({
1432
1432
  HSystem.delView(this.viewId);
1433
1433
  this.parent.viewsZOrder.splice( _viewZIdx, 1 );
1434
1434
  var _sysUpdateZIndexOfChildrenBufferIndex = HSystem._updateZIndexOfChildrenBuffer.indexOf( this.viewId );
1435
- if(_sysUpdateZIndexOfChildrenBufferIndex !== -1){
1435
+ if(~_sysUpdateZIndexOfChildrenBufferIndex){
1436
1436
  HSystem._updateZIndexOfChildrenBuffer.splice( _sysUpdateZIndexOfChildrenBufferIndex, 1 );
1437
1437
  }
1438
1438
 
@@ -2005,7 +2005,7 @@ HView = HClass.extend({
2005
2005
  **/
2006
2006
  unbindDomElement: function(_elementId) {
2007
2007
  var _indexOfElementId = this._domElementBindings.indexOf(_elementId);
2008
- if (_indexOfElementId > -1) {
2008
+ if (~_indexOfElementId) {
2009
2009
  ELEM.del(_elementId);
2010
2010
  this._domElementBindings.splice(_indexOfElementId, 1);
2011
2011
  }
@@ -2083,7 +2083,7 @@ HView = HClass.extend({
2083
2083
  return false;
2084
2084
  }
2085
2085
  if( typeof _obj['hasAncestor'] === 'function' ){
2086
- if( _obj.parents.indexOf( this ) !== -1 ){
2086
+ if( ~_obj.parents.indexOf( this ) ){
2087
2087
  return true;
2088
2088
  }
2089
2089
  }
@@ -60,7 +60,7 @@ HCheckboxList = HListItemControl.extend({
60
60
  *
61
61
  **/
62
62
  addItem: function( _listValue ){
63
- if(this.value.indexOf(_listValue) === -1){
63
+ if(!~this.value.indexOf(_listValue)){
64
64
  var _newValue = [], i = 0;
65
65
  for( ; i < this.value.length; i++ ){
66
66
  _newValue.push( this.value[i] );
@@ -80,7 +80,7 @@ HCheckboxList = HListItemControl.extend({
80
80
  **/
81
81
  delItem: function( _listValue ){
82
82
  var _listIndex = this.value.indexOf(_listValue);
83
- if(_listIndex !== -1){
83
+ if(~_listIndex){
84
84
  var _newValue = [], i = 0;
85
85
  for( ; i < this.value.length; i++ ){
86
86
  if(this.value[i] !== _listValue){
@@ -125,7 +125,7 @@ HCheckboxList = HListItemControl.extend({
125
125
  _listItem = _listItems[i];
126
126
  _value = _listItem[0];
127
127
  _label = _listItem[1];
128
- _checked = (this.value.indexOf( _value ) !== -1);
128
+ _checked = !!~this.value.indexOf( _value );
129
129
  _checkbox = this.ListCheckbox.nu(
130
130
  [ 4, (i*23)+4, null, 23, 4, null ],
131
131
  this, {
@@ -180,7 +180,7 @@ HCheckboxList = HListItemControl.extend({
180
180
  _isSelected;
181
181
  for( ; i < _listItems.length; i++ ){
182
182
  _listItemValue = _listItems[i][0];
183
- _isSelected = (_value.indexOf( _listItemValue ) !== -1);
183
+ _isSelected = !!~_value.indexOf( _listItemValue );
184
184
  this.listItemViews[i].setValue( _isSelected );
185
185
  if(_isSelected){
186
186
  _selectedItems.push( _listItemValue );
@@ -106,7 +106,7 @@ HListItemControl = HControl.extend({
106
106
  _listItems.push( _row );
107
107
  }
108
108
  // strings and integers
109
- else if ( ['s','n'].indexOf(_rowType) !== -1 ){
109
+ else if ( ~['s','n'].indexOf(_rowType) ){
110
110
  _label = _row.toString();
111
111
  _value = _row;
112
112
  _listItems.push( [_value, _label] );
@@ -68,7 +68,7 @@ HPropertyListEditor = HControl.extend({
68
68
  lostActiveStatus: function(newActive){
69
69
  this.base();
70
70
  if( newActive &&
71
- ( (newActive === this) || (newActive.parents.indexOf(this) !== -1) )
71
+ ( (newActive === this) || ~newActive.parents.indexOf(this) )
72
72
  ){
73
73
  return;
74
74
  }
@@ -132,7 +132,7 @@ HPropertyListEditor = HControl.extend({
132
132
  },
133
133
  refreshValue: function(){
134
134
  if(this.drawn){
135
- if(this.boldTypes.indexOf(this.parent.value.type)!==-1){
135
+ if(~this.boldTypes.indexOf(this.parent.value.type)){
136
136
  this.setStyle('font-weight','bold',true);
137
137
  }
138
138
  else{
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsence-pre
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0.1
4
+ version: 2.3.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-08-04 00:00:00.000000000 Z
13
+ date: 2012-08-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rsence-deps