@breakside/jskit 2022.25.1 → 2022.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/Frameworks/DOM.jsframework/Info.json +2 -2
  2. package/Frameworks/DOM.jsframework/io.breakside.JSKit.DOM-bundle.js +2 -2
  3. package/Frameworks/FontKit.jsframework/Info.json +2 -2
  4. package/Frameworks/FontKit.jsframework/io.breakside.JSKit.FontKit-bundle.js +2 -2
  5. package/Frameworks/Foundation.jsframework/Info.json +2 -2
  6. package/Frameworks/Foundation.jsframework/JS/JSFileManager+HTML.js +29 -19
  7. package/Frameworks/Foundation.jsframework/JS/JSUserDefaults.js +2 -2
  8. package/Frameworks/Foundation.jsframework/io.breakside.JSKit.Foundation-bundle.js +2 -2
  9. package/Frameworks/SecurityKit.jsframework/Info.json +2 -2
  10. package/Frameworks/SecurityKit.jsframework/io.breakside.JSKit.SecurityKit-bundle.js +2 -2
  11. package/Info.json +2 -2
  12. package/Node/io.breakside.jskit-bundle.js +2 -2
  13. package/Root/Frameworks/APIKit/Info.yaml +1 -1
  14. package/Root/Frameworks/APIKitTesting/Info.yaml +1 -1
  15. package/Root/Frameworks/AuthKit/Info.yaml +1 -1
  16. package/Root/Frameworks/AuthKit/OAService.js +8 -0
  17. package/Root/Frameworks/AuthKit/Services.yaml +2 -0
  18. package/Root/Frameworks/CSSOM/Info.yaml +1 -1
  19. package/Root/Frameworks/ChartKit/Info.yaml +1 -1
  20. package/Root/Frameworks/ConferenceKit/Info.yaml +1 -1
  21. package/Root/Frameworks/DBKit/Info.yaml +1 -1
  22. package/Root/Frameworks/DOM/Info.yaml +1 -1
  23. package/Root/Frameworks/Dispatch/Info.yaml +1 -1
  24. package/Root/Frameworks/FontKit/Info.yaml +1 -1
  25. package/Root/Frameworks/Foundation/Info.yaml +1 -1
  26. package/Root/Frameworks/Foundation/JSFileManager+HTML.js +29 -19
  27. package/Root/Frameworks/Foundation/JSUserDefaults.js +2 -2
  28. package/Root/Frameworks/ImageKit/Info.yaml +1 -1
  29. package/Root/Frameworks/MediaKit/Info.yaml +1 -1
  30. package/Root/Frameworks/MediaKitUI/Info.yaml +1 -1
  31. package/Root/Frameworks/NotificationKit/Info.yaml +1 -1
  32. package/Root/Frameworks/PDFKit/Info.yaml +1 -1
  33. package/Root/Frameworks/QRKit/Info.yaml +1 -1
  34. package/Root/Frameworks/SearchKit/Info.yaml +1 -1
  35. package/Root/Frameworks/SecurityKit/Info.yaml +1 -1
  36. package/Root/Frameworks/ServerKit/Info.yaml +1 -1
  37. package/Root/Frameworks/ServerKitTesting/Info.yaml +1 -1
  38. package/Root/Frameworks/TestKit/Info.yaml +1 -1
  39. package/Root/Frameworks/UIKit/Info.yaml +1 -1
  40. package/Root/Frameworks/UIKit/UICursor.js +19 -4
  41. package/Root/Frameworks/UIKit/UIDisplayServer.js +51 -10
  42. package/Root/Frameworks/UIKit/UIHTMLDisplayServerCanvasContext.js +2 -48
  43. package/Root/Frameworks/UIKit/UIHTMLDisplayServerContext.js +0 -6
  44. package/Root/Frameworks/UIKit/UIHTMLDisplayServerSVGContext.js +6 -77
  45. package/Root/Frameworks/UIKit/UIHTMLTextField.js +9 -3
  46. package/Root/Frameworks/UIKit/UIHTMLTextTypesetter.js +2 -29
  47. package/Root/Frameworks/UIKit/UIHTMLWindowServer.js +6 -79
  48. package/Root/Frameworks/UIKit/UIKit.js +1 -0
  49. package/Root/Frameworks/UIKit/UILabel.js +72 -1
  50. package/Root/Frameworks/UIKit/UILayer.js +3 -0
  51. package/Root/Frameworks/UIKit/UIMouseTrackingArea.js +55 -0
  52. package/Root/Frameworks/UIKit/UINavigationBar.js +45 -22
  53. package/Root/Frameworks/UIKit/UIState.js +18 -0
  54. package/Root/Frameworks/UIKit/UITextEditor.js +277 -76
  55. package/Root/Frameworks/UIKit/UITextEditorDelegate.js +3 -1
  56. package/Root/Frameworks/UIKit/UITextLayer.js +1 -1
  57. package/Root/Frameworks/UIKit/UIView.js +129 -46
  58. package/Root/Frameworks/UIKit/UIViewController.js +6 -0
  59. package/Root/Frameworks/UIKit/UIWindow.js +89 -0
  60. package/Root/Frameworks/UIKit/UIWindowServer.js +20 -79
  61. package/Root/Frameworks/UIKitTesting/Info.yaml +1 -1
  62. package/package.json +1 -1
@@ -19,6 +19,8 @@
19
19
  JSProtocol("UITextEditorDelegate", JSProtocol, {
20
20
 
21
21
  textEditorDidReplaceCharactersInRange: function(textEditor, range, insertedText){},
22
- textEditorDidPositionCursors: function(textEditor){}
22
+ textEditorDidPositionCursors: function(textEditor){},
23
+ textEditorPrepareInsertAttributes: function(textEditor, attributes){},
24
+ atomicRangeForTextEditorIndex: function(textEditor, index){}
23
25
 
24
26
  });
@@ -59,8 +59,8 @@ JSClass("UITextLayer", UILayer, {
59
59
  },
60
60
 
61
61
  didChangeSize: function(){
62
- UITextLayer.$super.didChangeSize.call(this);
63
62
  this._textContainer.size = this._availableTextSize();
63
+ UITextLayer.$super.didChangeSize.call(this);
64
64
  },
65
65
 
66
66
  // MARK: - Styling
@@ -22,6 +22,7 @@
22
22
  // #import "UITraitCollection.js"
23
23
  // #import "UICursor.js"
24
24
  // #import "UIAccessibility.js"
25
+ // #import "UIMouseTrackingArea.js"
25
26
  'use strict';
26
27
 
27
28
  JSGlobalObject.UIViewLayerProperty = function(){
@@ -183,7 +184,7 @@ JSClass('UIView', UIResponder, {
183
184
  shadowColor: UIViewLayerProperty(),
184
185
  shadowOffset: UIViewLayerProperty(),
185
186
  shadowRadius: UIViewLayerProperty(),
186
- cursor: JSDynamicProperty('_cursor', null),
187
+ cursor: JSDynamicProperty(),
187
188
  tooltip: null,
188
189
 
189
190
  // -------------------------------------------------------------------------
@@ -322,6 +323,17 @@ JSClass('UIView', UIResponder, {
322
323
  return null;
323
324
  },
324
325
 
326
+ isDescendantOfView: function(view){
327
+ if (view === null || view === undefined){
328
+ return false;
329
+ }
330
+ var superview = this.superview;
331
+ while (superview !== null && superview !== view){
332
+ superview = superview.superview;
333
+ }
334
+ return superview !== null && superview === view;
335
+ },
336
+
325
337
  // -------------------------------------------------------------------------
326
338
  // MARK: - Window
327
339
 
@@ -329,11 +341,21 @@ JSClass('UIView', UIResponder, {
329
341
 
330
342
  setWindow: function(window){
331
343
  if (window != this._window){
332
- if (this._window && this._window.firstResponder === this){
333
- this._window.firstResponder = null;
344
+ if (this._window){
345
+ if (this._window.firstResponder === this){
346
+ this._window.firstResponder = null;
347
+ }
348
+ if (this._mouseTrackingAreas !== null && this._mouseTrackingAreas.length > 0){
349
+ this._window.removeMouseTrackingView(this);
350
+ }
334
351
  }
335
352
  this._setWindowServer(window ? window.windowServer : null);
336
353
  this._window = window;
354
+ if (this._window){
355
+ if (this._mouseTrackingAreas !== null && this._mouseTrackingAreas.length > 0){
356
+ this._window.addMouseTrackingView(this);
357
+ }
358
+ }
337
359
  for (var i = 0, l = this.subviews.length; i < l; ++i){
338
360
  this.subviews[i].window = window;
339
361
  }
@@ -348,22 +370,6 @@ JSClass('UIView', UIResponder, {
348
370
 
349
371
  _setWindowServer: function(windowServer, includeSubviews){
350
372
  if (this._windowServer !== windowServer){
351
- if (this.cursor !== null){
352
- if (this._windowServer !== null){
353
- this._windowServer.viewDidChangeCursor(this, null);
354
- }
355
- if (windowServer !== null){
356
- windowServer.viewDidChangeCursor(this, this.cursor);
357
- }
358
- }
359
- if (this.mouseTrackingType !== UIView.MouseTracking.none){
360
- if (this._windowServer !== null){
361
- this._windowServer.viewDidChangeMouseTracking(this, UIView.MouseTracking.none);
362
- }
363
- if (windowServer !== null){
364
- windowServer.viewDidChangeMouseTracking(this, this.mouseTrackingType);
365
- }
366
- }
367
373
  if (this.isAccessibilityElement){
368
374
  if (this._windowServer !== null){
369
375
  this._windowServer.postNotificationsForAccessibilityElementDestroyed(this);
@@ -381,13 +387,6 @@ JSClass('UIView', UIResponder, {
381
387
  }
382
388
  },
383
389
 
384
- setCursor: function(cursor){
385
- this._cursor = cursor;
386
- if (this._windowServer !== null){
387
- this._windowServer.viewDidChangeCursor(this, this.cursor);
388
- }
389
- },
390
-
391
390
  windowDidChangeKeyStatus: function(){
392
391
  for (var i = 0, l = this.subviews.length; i < l; ++i){
393
392
  this.subviews[i].windowDidChangeKeyStatus();
@@ -547,6 +546,7 @@ JSClass('UIView', UIResponder, {
547
546
  layerDidChangeSize: function(layer){
548
547
  if (layer === this.layer){
549
548
  this.invalidateFocusRingPath();
549
+ this.updateMouseTrackingAreas();
550
550
  }
551
551
  },
552
552
 
@@ -680,9 +680,8 @@ JSClass('UIView', UIResponder, {
680
680
  },
681
681
 
682
682
  // -------------------------------------------------------------------------
683
- // MARK: - Responder & Mouse Tracking
684
-
685
- mouseTrackingType: 0,
683
+ // MARK: - Responder
684
+
686
685
  isMultipleTouchEnabled: false,
687
686
 
688
687
  isFirstResponder: function(){
@@ -696,24 +695,113 @@ JSClass('UIView', UIResponder, {
696
695
  return this.superview;
697
696
  },
698
697
 
699
- startMouseTracking: function(trackingType){
700
- this.mouseTrackingType = trackingType;
701
- if (this._windowServer !== null){
702
- this._windowServer.viewDidChangeMouseTracking(this, this.mouseTrackingType);
698
+ keyActive: JSReadOnlyProperty(undefined, undefined, 'isKeyActive'),
699
+
700
+ isKeyActive: function(){
701
+ return this.window !== null && this.window.isKeyWindow && this.window.firstResponder === this;
702
+ },
703
+
704
+ // -------------------------------------------------------------------------
705
+ // MARK: - Mouse Tracking
706
+
707
+ _mouseTrackingAreas: null,
708
+
709
+ addMouseTrackingArea: function(trackingArea){
710
+ if (this._mouseTrackingAreas === null){
711
+ this._mouseTrackingAreas = [];
712
+ }
713
+ var index = this._mouseTrackingAreas.indexOf(trackingArea);
714
+ if (index < 0){
715
+ trackingArea.view = this;
716
+ this._mouseTrackingAreas.push(trackingArea);
717
+ if (this._mouseTrackingAreas.length === 1 && this._window !== null){
718
+ this._window.addMouseTrackingView(this);
719
+ }
703
720
  }
704
721
  },
705
722
 
706
- stopMouseTracking: function(){
707
- this.mouseTrackingType = UIView.MouseTracking.none;
708
- if (this._windowServer !== null){
709
- this._windowServer.viewDidChangeMouseTracking(this, this.mouseTrackingType);
723
+ removeMouseTrackingArea: function(trackingArea){
724
+ if (this._mouseTrackingAreas !== null){
725
+ var index = this._mouseTrackingAreas.indexOf(trackingArea);
726
+ if (index >= 0){
727
+ if (trackingArea._entered && trackingArea.cursor !== null){
728
+ trackingArea.cursor.unset();
729
+ }
730
+ trackingArea._entered = false;
731
+ trackingArea.view = null;
732
+ this._mouseTrackingAreas.splice(index, 1);
733
+ if (this._window !== null && this._mouseTrackingAreas.length === 0){
734
+ this._window.removeMouseTrackingView(this);
735
+ }
736
+ }
710
737
  }
711
738
  },
712
739
 
713
- keyActive: JSReadOnlyProperty(undefined, undefined, 'isKeyActive'),
740
+ updateMouseTrackingAreas: function(){
741
+ if (this._startStopMouseTrackingArea !== null){
742
+ this._startStopMouseTrackingArea.rect = this.bounds;
743
+ }
744
+ if (this._cursorMouseTrackingArea !== null){
745
+ this._cursorMouseTrackingArea.rect = this.bounds;
746
+ }
747
+ },
714
748
 
715
- isKeyActive: function(){
716
- return this.window !== null && this.window.isKeyWindow && this.window.firstResponder === this;
749
+ _cursorMouseTrackingArea: null,
750
+
751
+ setCursor: function(cursor){
752
+ if (this._cursorMouseTrackingArea === null){
753
+ if (cursor !== null){
754
+ this._cursorMouseTrackingArea = UIMouseTrackingArea.initWithResponder(this, this.bounds, UIMouseTrackingArea.TrackingType.enterAndExit);
755
+ this._cursorMouseTrackingArea.cursor = cursor;
756
+ this.addMouseTrackingArea(this._cursorMouseTrackingArea);
757
+ }
758
+ }else{
759
+ if (cursor !== null){
760
+ this._cursorMouseTrackingArea.cursor = cursor;
761
+ if (this._cursorMouseTrackingArea._entered){
762
+ cursor.set();
763
+ }
764
+ }else{
765
+ this.removeMouseTrackingArea(this._cursorMouseTrackingArea);
766
+ this._cursorMouseTrackingArea = null;
767
+ }
768
+ }
769
+ },
770
+
771
+ getCursor: function(){
772
+ if (this._cursorMouseTrackingArea !== null){
773
+ return this._cursorMouseTrackingArea.cursor;
774
+ }
775
+ return null;
776
+ },
777
+
778
+ // legacy/deprecated
779
+
780
+ mouseTrackingType: JSReadOnlyProperty(),
781
+
782
+ getMouseTrackingType: function(){
783
+ if (this._startStopMouseTrackingArea !== null){
784
+ return this._startStopMouseTrackingArea.trackingType;
785
+ }
786
+ return UIView.MouseTracking.none;
787
+ },
788
+
789
+ _startStopMouseTrackingArea: null,
790
+
791
+ startMouseTracking: function(trackingType){
792
+ if (this._startStopMouseTrackingArea === null){
793
+ this._startStopMouseTrackingArea = UIMouseTrackingArea.initWithResponder(this, this.bounds, trackingType);
794
+ this.addMouseTrackingArea(this._startStopMouseTrackingArea);
795
+ }else{
796
+ this._startStopMouseTrackingArea.trackingType = trackingType;
797
+ }
798
+ },
799
+
800
+ stopMouseTracking: function(){
801
+ if (this._startStopMouseTrackingArea !== null){
802
+ this.removeMouseTrackingArea(this._startStopMouseTrackingArea);
803
+ this._startStopMouseTrackingArea = null;
804
+ }
717
805
  },
718
806
 
719
807
  // -------------------------------------------------------------------------
@@ -1047,12 +1135,7 @@ JSClass('UIView', UIResponder, {
1047
1135
 
1048
1136
  });
1049
1137
 
1050
- UIView.MouseTracking = {
1051
- none: 0,
1052
- move: 1,
1053
- enterAndExit: 2,
1054
- all: 3
1055
- };
1138
+ UIView.MouseTracking = UIMouseTrackingArea.TrackingType;
1056
1139
 
1057
1140
  UIView.layerClass = UILayer;
1058
1141
 
@@ -307,9 +307,15 @@ JSClass("UIViewController", UIResponder, {
307
307
  }
308
308
  }else{
309
309
  if (previousChildViewController !== null){
310
+ if (previousChildViewController._lifecycleState === UIViewController.LifecycleState.appearing){
311
+ previousChildViewController.scheduleDisappearance();
312
+ }
310
313
  previousChildViewController.removeFromParentViewController();
311
314
  }
312
315
  if (childViewController !== null){
316
+ if (this._lifecycleState === UIViewController.LifecycleState.appearing){
317
+ childViewController.beginAppearance(this._appearanceTransitionAnimated);
318
+ }
313
319
  this.addChildViewController(childViewController);
314
320
  }
315
321
  }
@@ -752,6 +752,95 @@ JSClass('UIWindow', UIView, {
752
752
  return JSRect(this.convertPointToScreen(rect.origin), rect.size);
753
753
  },
754
754
 
755
+ // -------------------------------------------------------------------------
756
+ // MARK: - Mouse Tracking
757
+
758
+ mouseTrackingViews: null,
759
+
760
+ addMouseTrackingView: function(view){
761
+ if (this.mouseTrackingViews === null){
762
+ this.mouseTrackingViews = [];
763
+ }
764
+ var index = this.mouseTrackingViews.indexOf(view);
765
+ if (index < 0){
766
+ this.mouseTrackingViews.push(view);
767
+ }
768
+ },
769
+
770
+ removeMouseTrackingView: function(view){
771
+ if (this.mouseTrackingViews === null){
772
+ return;
773
+ }
774
+ var index = this.mouseTrackingViews.indexOf(view);
775
+ if (index >= 0){
776
+ this.mouseTrackingViews.splice(index, 1);
777
+ }
778
+ },
779
+
780
+ sendMouseTrackingEvents: function(locationInWindow, timestamp, modifiers, isExiting){
781
+ if (this.mouseTrackingViews === null || this.mouseTrackingViews.length === 0){
782
+ return;
783
+ }
784
+ var view;
785
+ var area;
786
+ var viewIndex, viewCount;
787
+ var areaIndex, areaCount;
788
+ var location;
789
+ var enters = [];
790
+ var exits = [];
791
+ var moves = [];
792
+ for (viewIndex = 0, viewCount = this.mouseTrackingViews.length; viewIndex < viewCount; ++viewIndex){
793
+ view = this.mouseTrackingViews[viewIndex];
794
+ location = this.convertPointToView(locationInWindow, view);
795
+ for (areaIndex = 0, areaCount = view._mouseTrackingAreas.length; areaIndex < areaCount; ++areaIndex){
796
+ area = view._mouseTrackingAreas[areaIndex];
797
+ if (!isExiting && !view.hidden && view.userInteractionEnabled && area.containsPoint(location)){
798
+ if (!area._entered){
799
+ area._entered = true;
800
+ if ((area.trackingType & UIMouseTrackingArea.TrackingType.enterAndExit) !== 0){
801
+ enters.push(area);
802
+ }
803
+ }
804
+ if ((area.trackingType & UIMouseTrackingArea.TrackingType.move) !== 0){
805
+ moves.push(area);
806
+ }
807
+ }else{
808
+ if (area._entered){
809
+ area._entered = false;
810
+ if ((area.trackingType & UIMouseTrackingArea.TrackingType.enterAndExit) !== 0){
811
+ exits.push(area);
812
+ }
813
+ }
814
+ }
815
+ }
816
+ }
817
+ // FIXME: the order could be important here for views that overlap and
818
+ // set cursors. We'd want the topmost one to be called last for enters
819
+ // and first for exits
820
+ var event;
821
+ if (exits.length > 0){
822
+ event = UIEvent.initMouseEventWithType(UIEvent.Type.mouseExited, timestamp, this, locationInWindow, modifiers, 0);
823
+ for (areaIndex = 0, areaCount = exits.length; areaIndex < areaCount; ++areaIndex){
824
+ area = exits[areaIndex];
825
+ area.mouseExited(event);
826
+ }
827
+ }
828
+ if (enters.length > 0){
829
+ event = UIEvent.initMouseEventWithType(UIEvent.Type.mouseEntered, timestamp, this, locationInWindow, modifiers, 0);
830
+ for (areaIndex = 0, areaCount = enters.length; areaIndex < areaCount; ++areaIndex){
831
+ area = enters[areaIndex];
832
+ area.mouseEntered(event);
833
+ }
834
+ }
835
+ if (moves.length > 0){
836
+ event = UIEvent.initMouseEventWithType(UIEvent.Type.mouseMoved, timestamp, this, locationInWindow, modifiers, 0);
837
+ for (areaIndex = 0, areaCount = moves.length; areaIndex < areaCount; ++areaIndex){
838
+ area = moves[areaIndex];
839
+ area.mouseMoved(event);
840
+ }
841
+ }
842
+ },
843
+
755
844
  // -------------------------------------------------------------------------
756
845
  // MARK: - Event Dispatch
757
846
 
@@ -209,6 +209,9 @@ JSClass("UIWindowServer", JSObject, {
209
209
  this.windowStack.splice(i, 1);
210
210
  this.displayServer.windowRemoved(window);
211
211
  window._screen = null;
212
+ if (window === this._mouseTrackingWindow){
213
+ this._mouseTrackingWindow = null;
214
+ }
212
215
  break;
213
216
  }
214
217
  this.windowStack[i].subviewIndex = this.windowStack[i].layer.sublayerIndex = i - 1;
@@ -252,23 +255,10 @@ JSClass("UIWindowServer", JSObject, {
252
255
  this._endWindowOrderChange();
253
256
  },
254
257
 
255
- _previousEventWindow: null,
256
-
257
258
  _beginWindowOrderChange: function(){
258
- if (this._previousEventWindow !== null){
259
- return;
260
- }
261
- this._previousEventWindow = this.windowForEventAtLocation(this.mouseLocation);
262
259
  },
263
260
 
264
261
  _endWindowOrderChange: function(){
265
- if (this._previousEventWindow === null){
266
- return;
267
- }
268
- var previousEventWindow = this._previousEventWindow;
269
- var currentEventWindow = this.windowForEventAtLocation(this.mouseLocation);
270
- this._previousEventWindow = null;
271
- this._createTrackingEventsForWindowLevelChangeAtLocation(this.mouseLocation, previousEventWindow, currentEventWindow);
272
262
  },
273
263
 
274
264
  // -----------------------------------------------------------------------
@@ -325,10 +315,6 @@ JSClass("UIWindowServer", JSObject, {
325
315
  // -----------------------------------------------------------------------
326
316
  // MARK: - Cursor Managment
327
317
 
328
- viewDidChangeCursor: function(view, cursor){
329
- // subclasses should override
330
- },
331
-
332
318
  hideCursor: function(){
333
319
  // subclasses should override
334
320
  },
@@ -696,6 +682,7 @@ JSClass("UIWindowServer", JSObject, {
696
682
  this.draggingSessionDidChangeLocation();
697
683
  }else{
698
684
  if (this.mouseDownCount === 0){
685
+ this.sendMouseTrackingEvents(timestamp, modifiers);
699
686
  if (this._tooltipWindow === null){
700
687
  this._mouseIdleTimer.schedule();
701
688
  }else{
@@ -728,74 +715,28 @@ JSClass("UIWindowServer", JSObject, {
728
715
  // -----------------------------------------------------------------------
729
716
  // MARK: - Mouse Tracking
730
717
 
731
- viewDidChangeMouseTracking: function(view, trackingType){
732
- // subclasses should override
733
- },
734
-
735
- createMouseTrackingEvent: function(type, timestamp, location, modifiers, view, force){
736
- if (!force && !this._shouldCreateTrackingEventForView(view)){
737
- return;
738
- }
739
- var event = UIEvent.initMouseEventWithType(type, timestamp, view.window, view.window.convertPointFromScreen(location), modifiers, 0);
740
- event.trackingView = view;
741
- this._sendEventToApplication(event, view.window.application);
742
- },
743
-
744
- _shouldCreateTrackingEventForView: function(view){
745
- if (this.mouseEventWindow !== null){
746
- // no tracking events if the mouse is down
747
- return false;
748
- }
749
- var window = view.window;
750
- if (window === null){
751
- return false;
752
- }
753
- if (window.shouldReceiveTrackingInBack){
754
- return true;
755
- }
756
- if (window.receivesAllEvents){
757
- return true;
758
- }
759
- if (window === this.mainWindow){
760
- return true;
761
- }
762
- if (window === this.keyWindow){
763
- return true;
764
- }
765
- return true;
766
- },
718
+ _mouseTrackingWindow: null,
767
719
 
768
- _createTrackingEventsForWindowLevelChangeAtLocation: function(location, previousWindow, currentWindow){
769
- if (currentWindow === previousWindow){
770
- return;
771
- }
772
- var view;
773
- if (previousWindow !== null && (previousWindow.objectID in this._windowsById)){
774
- view = this._trackingViewInWindowAtLocation(previousWindow, location);
775
- if (view !== null){
776
- this.createMouseTrackingEvent(UIEvent.Type.mouseExited, -1, location, UIEvent.Modifier.none, view, true);
720
+ sendMouseTrackingEvents: function(timestamp, modifiers){
721
+ var window = null;
722
+ var windowIndex;
723
+ var location;
724
+ var event;
725
+ for (windowIndex = this.windowStack.length - 1; windowIndex >= 0 && window === null; --windowIndex){
726
+ location = this.windowStack[windowIndex].convertPointFromScreen(this.mouseLocation);
727
+ if (this.windowStack[windowIndex].userInteractionEnabled && this.windowStack[windowIndex].containsPoint(location)){
728
+ window = this.windowStack[windowIndex];
777
729
  }
778
730
  }
779
- if (currentWindow !== null && (currentWindow.objectID in this._windowsById)){
780
- view = this._trackingViewInWindowAtLocation(currentWindow, location);
781
- if (view !== null){
782
- this.createMouseTrackingEvent(UIEvent.Type.mouseEntered, -1, location, UIEvent.Modifier.none, view, true);
731
+ if (this._mouseTrackingWindow !== null){
732
+ if (window !== this._mouseTrackingWindow){
733
+ this._mouseTrackingWindow.sendMouseTrackingEvents(this._mouseTrackingWindow.convertPointFromScreen(this.mouseLocation), timestamp, modifiers, true);
783
734
  }
784
735
  }
785
- },
786
-
787
- _trackingViewInWindowAtLocation: function(window, location){
788
- var view = window.hitTest(window.convertPointFromScreen(location));
789
- if (view === null){
790
- return null;
791
- }
792
- while (view.superview !== null && ((view.mouseTrackingType & UIView.MouseTracking.enterAndExit) === 0)){
793
- view = view.superview;
736
+ this._mouseTrackingWindow = window;
737
+ if (this._mouseTrackingWindow !== null){
738
+ this._mouseTrackingWindow.sendMouseTrackingEvents(this._mouseTrackingWindow.convertPointFromScreen(this.mouseLocation), timestamp, modifiers, false);
794
739
  }
795
- if ((view.mouseTrackingType & UIView.MouseTracking.enterAndExit) !== 0){
796
- return view;
797
- }
798
- return null;
799
740
  },
800
741
 
801
742
  // -----------------------------------------------------------------------
@@ -1,6 +1,6 @@
1
1
  JSBundleType: framework
2
2
  JSBundleIdentifier: io.breakside.JSKit.UIKitTesting
3
- JSBundleVersion: 2022.25.1
3
+ JSBundleVersion: 2022.28.0
4
4
  JSDevelopmentLanguage: en
5
5
  JSCopyright: Copyright © 2020 Breakside Inc.
6
6
  JSLicenseNotice: |
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "node": ">=10.10.0"
10
10
  },
11
11
  "name": "@breakside/jskit",
12
- "version": "2022.25.1",
12
+ "version": "2022.28.0",
13
13
  "license": "SEE LICENSE IN LICENSE.txt",
14
14
  "files": [
15
15
  "*"