@galacean/effects-threejs 2.10.0-alpha.3 → 2.10.0-alpha.4

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.
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  * Description: Galacean Effects runtime threejs plugin for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v2.10.0-alpha.3
6
+ * Version: v2.10.0-alpha.4
7
7
  */
8
8
 
9
9
  import * as THREE from 'three';
@@ -23128,10 +23128,10 @@ var Graphics = /*#__PURE__*/ function() {
23128
23128
  this.currentTransform = Matrix3.fromIdentity();
23129
23129
  this.currentBatchType = "colored";
23130
23130
  this.currentBatchTexture = null;
23131
- // 创建从屏幕坐标到 NDC 的投影矩阵,屏幕坐标: (0, 0) 在左下角,(width, height) 在右上角
23131
+ // 创建从屏幕坐标到 NDC 的投影矩阵,屏幕坐标:(0, 0) 在左上角,(width, height) 在右下角,+Y 向下。
23132
23132
  var _this_engine_canvas_getBoundingClientRect = this.engine.canvas.getBoundingClientRect(), width = _this_engine_canvas_getBoundingClientRect.width, height = _this_engine_canvas_getBoundingClientRect.height;
23133
23133
  // 正交投影矩阵:将屏幕坐标 [0, width] x [0, height] 映射到 NDC [-1, 1] x [-1, 1]
23134
- var projectionMatrix = new Matrix4(2 / width, 0, 0, 0, 0, 2 / height, 0, 0, 0, 0, -1, 0, -1, -1, 0, 1 // 第四列
23134
+ var projectionMatrix = new Matrix4(2 / width, 0, 0, 0, 0, -2 / height, 0, 0, 0, 0, -1, 0, -1, 1, 0, 1 // 第四列
23135
23135
  );
23136
23136
  this.coloredMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
23137
23137
  this.texturedMaterial.setMatrix("effects_MatrixVP", projectionMatrix);
@@ -23296,8 +23296,8 @@ var Graphics = /*#__PURE__*/ function() {
23296
23296
  };
23297
23297
  /**
23298
23298
  * 绘制矩形边框
23299
- * @param x - 矩形左下角 X 坐标
23300
- * @param y - 矩形左下角 Y 坐标
23299
+ * @param x - 矩形左上角 X 坐标
23300
+ * @param y - 矩形左上角 Y 坐标
23301
23301
  * @param width - 矩形宽度
23302
23302
  * @param height - 矩形高度
23303
23303
  * @param color - 边框颜色,默认白色,范围 0-1
@@ -23340,8 +23340,8 @@ var Graphics = /*#__PURE__*/ function() {
23340
23340
  };
23341
23341
  /**
23342
23342
  * 绘制填充矩形
23343
- * @param x - 矩形左下角 X 坐标
23344
- * @param y - 矩形左下角 Y 坐标
23343
+ * @param x - 矩形左上角 X 坐标
23344
+ * @param y - 矩形左上角 Y 坐标
23345
23345
  * @param width - 矩形宽度
23346
23346
  * @param height - 矩形高度
23347
23347
  * @param color - 填充颜色,默认白色,范围 0-1
@@ -23367,9 +23367,9 @@ var Graphics = /*#__PURE__*/ function() {
23367
23367
  this.buildShape(this.circleShape, color);
23368
23368
  };
23369
23369
  /**
23370
- * 绘制纹理矩形(本地坐标,Y 向上,(x, y) 为左下角)
23371
- * @param x - 矩形左下角 X 坐标
23372
- * @param y - 矩形左下角 Y 坐标
23370
+ * 绘制纹理矩形(本地坐标,Y 向下,(x, y) 为左上角)
23371
+ * @param x - 矩形左上角 X 坐标
23372
+ * @param y - 矩形左上角 Y 坐标
23373
23373
  * @param width - 矩形宽度
23374
23374
  * @param height - 矩形高度
23375
23375
  * @param texture - 要采样的纹理。同纹理连续绘制会合批,纹理切换会自动 flush 当前批次
@@ -23382,14 +23382,14 @@ var Graphics = /*#__PURE__*/ function() {
23382
23382
  this.pushQuad(x, y, width, height, color, region);
23383
23383
  };
23384
23384
  /**
23385
- * 绘制文本(本地坐标,Y 向上,(x, y) 为文本左下角)。
23385
+ * 绘制文本(本地坐标,Y 向下,(x, y) 为文本 cell 左上角)。
23386
23386
  *
23387
23387
  * 文本走字符级 bitmap atlas(同一字体下每个字只渲染一次,任意文本组合复用 atlas);
23388
23388
  * `color` 作为乘色与白色字形 alpha 相乘,任意颜色都不会污染 atlas。
23389
23389
  *
23390
23390
  * 字体参数全部展开,避免调用方每帧创建临时 style 对象触发 GC
23391
- * @param x - 文本左下角 X 坐标(首字 ink 起始处,含 padding 的 quad 会向左延伸)
23392
- * @param y - 文本左下角 Y 坐标(cell 底,含底部 padding;字形 ink 在其上方 padding+ascent 处)
23391
+ * @param x - 文本左上角 X 坐标(首字 ink 起始处,含 padding 的 quad 会向左延伸)
23392
+ * @param y - 文本 cell 顶部 Y 坐标
23393
23393
  * @param text - 要绘制的文本内容,空串直接 return
23394
23394
  * @param fontSize - 字号(逻辑像素)
23395
23395
  * @param color - 乘色,默认白色,范围 0-1
@@ -23504,7 +23504,7 @@ var Graphics = /*#__PURE__*/ function() {
23504
23504
  * 在像素级亚像素精度下会暴露 1-2 像素缝隙,叠层时底层颜色透出形成可见的对角痕迹
23505
23505
  */ _proto.pushQuad = function pushQuad(x, y, width, height, color, region) {
23506
23506
  var vertexOffset = this.vertices.length / 2;
23507
- // 4 顶点(本地坐标,左下/右下/左上/右上),应用当前变换写入 vertices
23507
+ // 4 顶点(本地坐标,左上/右上/左下/右下),应用当前变换写入 vertices
23508
23508
  var corners = [
23509
23509
  [
23510
23510
  x,
@@ -23530,19 +23530,19 @@ var Graphics = /*#__PURE__*/ function() {
23530
23530
  var cornerUVs = [
23531
23531
  [
23532
23532
  u0,
23533
- v0
23533
+ v1
23534
23534
  ],
23535
23535
  [
23536
23536
  u1,
23537
- v0
23537
+ v1
23538
23538
  ],
23539
23539
  [
23540
23540
  u0,
23541
- v1
23541
+ v0
23542
23542
  ],
23543
23543
  [
23544
23544
  u1,
23545
- v1
23545
+ v0
23546
23546
  ]
23547
23547
  ];
23548
23548
  for(var i = 0; i < 4; i++){
@@ -24636,8 +24636,18 @@ var InputEvent = /*#__PURE__*/ function() {
24636
24636
  this.device = 0;
24637
24637
  this.pressed = false;
24638
24638
  this.canceled = false;
24639
+ this._accepted = false;
24639
24640
  }
24640
24641
  var _proto = InputEvent.prototype;
24642
+ _proto.accept = function accept() {
24643
+ this._accepted = true;
24644
+ };
24645
+ _proto.clearAccepted = function clearAccepted() {
24646
+ this._accepted = false;
24647
+ };
24648
+ _proto.isAccepted = function isAccepted() {
24649
+ return this._accepted;
24650
+ };
24641
24651
  _proto.isPressed = function isPressed() {
24642
24652
  return this.pressed && !this.canceled;
24643
24653
  };
@@ -24651,11 +24661,7 @@ var InputEvent = /*#__PURE__*/ function() {
24651
24661
  return false;
24652
24662
  };
24653
24663
  _proto.xformedBy = function xformedBy(transform) {
24654
- var event = new InputEvent();
24655
- event.device = this.device;
24656
- event.pressed = this.pressed;
24657
- event.canceled = this.canceled;
24658
- return event;
24664
+ return this;
24659
24665
  };
24660
24666
  return InputEvent;
24661
24667
  }();
@@ -24686,11 +24692,6 @@ var InputEventWithModifiers = /*#__PURE__*/ function(InputEvent) {
24686
24692
  event.metaPressed = this.metaPressed;
24687
24693
  event.ctrlPressed = this.ctrlPressed;
24688
24694
  };
24689
- _proto.xformedBy = function xformedBy(transform) {
24690
- var event = new InputEventWithModifiers();
24691
- this.copyModifiersTo(event);
24692
- return event;
24693
- };
24694
24695
  return InputEventWithModifiers;
24695
24696
  }(_wrap_native_super(InputEvent));
24696
24697
  var InputEventKey = /*#__PURE__*/ function(InputEventWithModifiers) {
@@ -24710,17 +24711,6 @@ var InputEventKey = /*#__PURE__*/ function(InputEventWithModifiers) {
24710
24711
  _proto.isEcho = function isEcho() {
24711
24712
  return this.echo;
24712
24713
  };
24713
- _proto.xformedBy = function xformedBy(transform) {
24714
- var event = new InputEventKey();
24715
- this.copyModifiersTo(event);
24716
- event.keycode = this.keycode;
24717
- event.physicalKeycode = this.physicalKeycode;
24718
- event.keyLabel = this.keyLabel;
24719
- event.unicode = this.unicode;
24720
- event.location = this.location;
24721
- event.echo = this.echo;
24722
- return event;
24723
- };
24724
24714
  return InputEventKey;
24725
24715
  }(InputEventWithModifiers);
24726
24716
  var InputEventMouse = /*#__PURE__*/ function(InputEventWithModifiers) {
@@ -24740,12 +24730,6 @@ var InputEventMouse = /*#__PURE__*/ function(InputEventWithModifiers) {
24740
24730
  event.position.copyFrom(this.position);
24741
24731
  event.globalPosition.copyFrom(this.globalPosition);
24742
24732
  };
24743
- _proto.xformedBy = function xformedBy(transform) {
24744
- var event = new InputEventMouse();
24745
- this.copyMouseTo(event);
24746
- event.position.copyFrom(transformPoint(transform, this.position));
24747
- return event;
24748
- };
24749
24733
  return InputEventMouse;
24750
24734
  }(InputEventWithModifiers);
24751
24735
  var InputEventMouseButton = /*#__PURE__*/ function(InputEventMouse) {
@@ -24862,27 +24846,27 @@ var InputEventScreenDrag = /*#__PURE__*/ function(InputEvent) {
24862
24846
  var ANCHOR_PRESET_TABLE = {
24863
24847
  topLeft: [
24864
24848
  0,
24865
- 1,
24866
24849
  0,
24867
- 1
24850
+ 0,
24851
+ 0
24868
24852
  ],
24869
24853
  topRight: [
24870
24854
  1,
24855
+ 0,
24871
24856
  1,
24872
- 1,
24873
- 1
24857
+ 0
24874
24858
  ],
24875
24859
  bottomLeft: [
24876
24860
  0,
24861
+ 1,
24877
24862
  0,
24878
- 0,
24879
- 0
24863
+ 1
24880
24864
  ],
24881
24865
  bottomRight: [
24882
24866
  1,
24883
- 0,
24884
24867
  1,
24885
- 0
24868
+ 1,
24869
+ 1
24886
24870
  ],
24887
24871
  centerLeft: [
24888
24872
  0,
@@ -24892,9 +24876,9 @@ var ANCHOR_PRESET_TABLE = {
24892
24876
  ],
24893
24877
  centerTop: [
24894
24878
  0.5,
24895
- 1,
24879
+ 0,
24896
24880
  0.5,
24897
- 1
24881
+ 0
24898
24882
  ],
24899
24883
  centerRight: [
24900
24884
  1,
@@ -24904,9 +24888,9 @@ var ANCHOR_PRESET_TABLE = {
24904
24888
  ],
24905
24889
  centerBottom: [
24906
24890
  0.5,
24907
- 0,
24891
+ 1,
24908
24892
  0.5,
24909
- 0
24893
+ 1
24910
24894
  ],
24911
24895
  center: [
24912
24896
  0.5,
@@ -24921,10 +24905,10 @@ var ANCHOR_PRESET_TABLE = {
24921
24905
  1
24922
24906
  ],
24923
24907
  topWide: [
24908
+ 0,
24924
24909
  0,
24925
24910
  1,
24926
- 1,
24927
- 1
24911
+ 0
24928
24912
  ],
24929
24913
  rightWide: [
24930
24914
  1,
@@ -24933,10 +24917,10 @@ var ANCHOR_PRESET_TABLE = {
24933
24917
  1
24934
24918
  ],
24935
24919
  bottomWide: [
24936
- 0,
24937
24920
  0,
24938
24921
  1,
24939
- 0
24922
+ 1,
24923
+ 1
24940
24924
  ],
24941
24925
  vcenterWide: [
24942
24926
  0.5,
@@ -25122,6 +25106,7 @@ var ANCHOR_PRESET_TABLE = {
25122
25106
  var a = this.anchorMin;
25123
25107
  var b = this.anchorMax;
25124
25108
  var minX = 0, maxX = 0, minY = 0, maxY = 0;
25109
+ // Left edge.
25125
25110
  switch(preset){
25126
25111
  case "topLeft":
25127
25112
  case "bottomLeft":
@@ -25132,41 +25117,71 @@ var ANCHOR_PRESET_TABLE = {
25132
25117
  case "hcenterWide":
25133
25118
  case "fullRect":
25134
25119
  minX = margin - a.x * parentSize.x;
25135
- maxX = margin + width - b.x * parentSize.x;
25136
25120
  break;
25137
25121
  case "centerTop":
25138
25122
  case "centerBottom":
25139
25123
  case "center":
25140
25124
  case "vcenterWide":
25141
25125
  minX = 0.5 * parentSize.x - width / 2 - a.x * parentSize.x;
25142
- maxX = 0.5 * parentSize.x + width / 2 - b.x * parentSize.x;
25143
25126
  break;
25144
25127
  default:
25145
25128
  minX = parentSize.x - margin - width - a.x * parentSize.x;
25146
- maxX = parentSize.x - margin - b.x * parentSize.x;
25147
25129
  break;
25148
25130
  }
25149
25131
  switch(preset){
25132
+ case "topLeft":
25150
25133
  case "bottomLeft":
25151
- case "bottomRight":
25134
+ case "centerLeft":
25135
+ case "leftWide":
25136
+ maxX = margin + width - b.x * parentSize.x;
25137
+ break;
25138
+ case "centerTop":
25152
25139
  case "centerBottom":
25140
+ case "center":
25141
+ case "vcenterWide":
25142
+ maxX = 0.5 * parentSize.x + width / 2 - b.x * parentSize.x;
25143
+ break;
25144
+ default:
25145
+ maxX = parentSize.x - margin - b.x * parentSize.x;
25146
+ break;
25147
+ }
25148
+ // Top edge.
25149
+ switch(preset){
25150
+ case "topLeft":
25151
+ case "topRight":
25152
+ case "centerTop":
25153
25153
  case "leftWide":
25154
25154
  case "rightWide":
25155
- case "bottomWide":
25155
+ case "topWide":
25156
25156
  case "vcenterWide":
25157
25157
  case "fullRect":
25158
25158
  minY = margin - a.y * parentSize.y;
25159
- maxY = margin + height - b.y * parentSize.y;
25160
25159
  break;
25161
25160
  case "centerLeft":
25162
25161
  case "centerRight":
25163
25162
  case "center":
25164
25163
  case "hcenterWide":
25165
25164
  minY = 0.5 * parentSize.y - height / 2 - a.y * parentSize.y;
25166
- maxY = 0.5 * parentSize.y + height / 2 - b.y * parentSize.y;
25167
25165
  break;
25168
25166
  default:
25169
25167
  minY = parentSize.y - margin - height - a.y * parentSize.y;
25168
+ break;
25169
+ }
25170
+ // Bottom edge.
25171
+ switch(preset){
25172
+ case "topLeft":
25173
+ case "topRight":
25174
+ case "centerTop":
25175
+ case "topWide":
25176
+ maxY = margin + height - b.y * parentSize.y;
25177
+ break;
25178
+ case "centerLeft":
25179
+ case "centerRight":
25180
+ case "center":
25181
+ case "hcenterWide":
25182
+ maxY = 0.5 * parentSize.y + height / 2 - b.y * parentSize.y;
25183
+ break;
25184
+ default:
25170
25185
  maxY = parentSize.y - margin - b.y * parentSize.y;
25171
25186
  break;
25172
25187
  }
@@ -25195,10 +25210,6 @@ var ANCHOR_PRESET_TABLE = {
25195
25210
  _proto.getCursorShape = function getCursorShape(position) {
25196
25211
  return this.defaultCursorShape;
25197
25212
  };
25198
- _proto.acceptEvent = function acceptEvent() {
25199
- var _this_root;
25200
- (_this_root = this.root) == null ? void 0 : _this_root.acceptControlEvent(this);
25201
- };
25202
25213
  _proto.focus = function focus() {
25203
25214
  var _this_root;
25204
25215
  (_this_root = this.root) == null ? void 0 : _this_root.grabControlFocus(this);
@@ -25279,14 +25290,14 @@ var ANCHOR_PRESET_TABLE = {
25279
25290
  this.engine.graphics.drawText(x, y, text, fontSize, color, fontFamily, fontWeight, fontStyle);
25280
25291
  };
25281
25292
  _proto.onMouseEnter = function onMouseEnter(location) {};
25282
- _proto.onMouseMove = function onMouseMove(location, event) {};
25293
+ _proto.onMouseMove = function onMouseMove(event) {};
25283
25294
  _proto.onMouseLeave = function onMouseLeave() {};
25284
- _proto.onMouseWheel = function onMouseWheel(location, delta, event) {};
25285
- _proto.onMouseDown = function onMouseDown(location, button, event) {};
25286
- _proto.onMouseUp = function onMouseUp(location, button, event) {};
25287
- _proto.onTouchDown = function onTouchDown(location, pointerId, event) {};
25288
- _proto.onTouchMove = function onTouchMove(location, pointerId, event) {};
25289
- _proto.onTouchUp = function onTouchUp(location, pointerId, event) {};
25295
+ _proto.onMouseWheel = function onMouseWheel(event) {};
25296
+ _proto.onMouseDown = function onMouseDown(event) {};
25297
+ _proto.onMouseUp = function onMouseUp(event) {};
25298
+ _proto.onTouchDown = function onTouchDown(event) {};
25299
+ _proto.onTouchMove = function onTouchMove(event) {};
25300
+ _proto.onTouchUp = function onTouchUp(event) {};
25290
25301
  _proto.onKeyDown = function onKeyDown(event) {};
25291
25302
  _proto.onKeyUp = function onKeyUp(event) {};
25292
25303
  _proto.onGotFocus = function onGotFocus() {};
@@ -25321,10 +25332,10 @@ var ANCHOR_PRESET_TABLE = {
25321
25332
  var _this_parent_size;
25322
25333
  var parentSize = (_this_parent_size = (_this_parent = this.parent) == null ? void 0 : _this_parent.size) != null ? _this_parent_size : new Vector2();
25323
25334
  var left = this.offsetMin.x + this.anchorMin.x * parentSize.x;
25324
- var bottom = this.offsetMin.y + this.anchorMin.y * parentSize.y;
25335
+ var top = this.offsetMin.y + this.anchorMin.y * parentSize.y;
25325
25336
  var right = this.offsetMax.x + this.anchorMax.x * parentSize.x;
25326
- var top = this.offsetMax.y + this.anchorMax.y * parentSize.y;
25327
- this.applyBounds(left, bottom, right - left, top - bottom);
25337
+ var bottom = this.offsetMax.y + this.anchorMax.y * parentSize.y;
25338
+ this.applyBounds(left, top, right - left, bottom - top);
25328
25339
  };
25329
25340
  _proto.applyBounds = function applyBounds(x, y, width, height) {
25330
25341
  var locationChanged = this.position.x !== x || this.position.y !== y;
@@ -25535,7 +25546,12 @@ var ANCHOR_PRESET_TABLE = {
25535
25546
  return this._defaultCursorShape;
25536
25547
  },
25537
25548
  set: function set(value) {
25549
+ var _this_root;
25550
+ if (this._defaultCursorShape === value) {
25551
+ return;
25552
+ }
25538
25553
  this._defaultCursorShape = value;
25554
+ (_this_root = this.root) == null ? void 0 : _this_root.updateMouseCursorState();
25539
25555
  }
25540
25556
  },
25541
25557
  {
@@ -25719,9 +25735,6 @@ function getButtonMask(button) {
25719
25735
  function isWheelButton(button) {
25720
25736
  return button >= MouseButton.WheelUp && button <= MouseButton.WheelRight;
25721
25737
  }
25722
- function getWheelDelta(event) {
25723
- return event.buttonIndex === MouseButton.WheelUp || event.buttonIndex === MouseButton.WheelLeft ? event.factor : -event.factor;
25724
- }
25725
25738
  /** CanvasLayer-like boundary for a single UICanvas GUI tree. */ var CanvasRootControl = /*#__PURE__*/ function(ContainerControl) {
25726
25739
  _inherits(CanvasRootControl, ContainerControl);
25727
25740
  function CanvasRootControl(engine, canvas) {
@@ -25780,7 +25793,7 @@ function getWheelDelta(event) {
25780
25793
  var _this;
25781
25794
  _this = RootControl.call(this, engine) || this;
25782
25795
  _this.dragThreshold = 10;
25783
- _this.inputHandled = false;
25796
+ _this.lastInput = null;
25784
25797
  _this.gui = {
25785
25798
  mouseFocus: null,
25786
25799
  mouseClickGrabber: null,
@@ -25807,13 +25820,16 @@ function getWheelDelta(event) {
25807
25820
  }
25808
25821
  var _proto = WindowRootControl.prototype;
25809
25822
  _proto.pushInput = function pushInput(event) {
25810
- this.inputHandled = false;
25823
+ event.clearAccepted();
25824
+ this.lastInput = event;
25811
25825
  this.cleanupInternalState();
25812
25826
  this.processGUIInput(event);
25813
25827
  this.postGrabClickFocus();
25814
25828
  };
25815
25829
  _proto.isInputHandled = function isInputHandled() {
25816
- return this.inputHandled;
25830
+ var _this_lastInput;
25831
+ var _this_lastInput_isAccepted;
25832
+ return (_this_lastInput_isAccepted = (_this_lastInput = this.lastInput) == null ? void 0 : _this_lastInput.isAccepted()) != null ? _this_lastInput_isAccepted : false;
25817
25833
  };
25818
25834
  _proto.getMousePosition = function getMousePosition() {
25819
25835
  return this.gui.lastMousePosition.clone();
@@ -25836,11 +25852,6 @@ function getWheelDelta(event) {
25836
25852
  _proto.guiCancelDrag = function guiCancelDrag() {
25837
25853
  this.endDragging(false);
25838
25854
  };
25839
- _proto.acceptControlEvent = function acceptControlEvent(control) {
25840
- if (this.isControlUsable(control)) {
25841
- this.inputHandled = true;
25842
- }
25843
- };
25844
25855
  _proto.grabControlFocus = function grabControlFocus(control) {
25845
25856
  if (!this.isFocusTargetUsable(control) || this.gui.keyFocus === control) {
25846
25857
  return;
@@ -25874,6 +25885,12 @@ function getWheelDelta(event) {
25874
25885
  _proto.warpControlMouse = function warpControlMouse(position) {
25875
25886
  this.gui.lastMousePosition.copyFrom(position);
25876
25887
  this.updateMouseOver(position);
25888
+ this.updateMouseCursorState();
25889
+ };
25890
+ _proto.updateMouseCursorState = function updateMouseCursorState() {
25891
+ var position = this.gui.lastMousePosition;
25892
+ var target = this.isControlUsable(this.gui.mouseFocus) ? this.gui.mouseFocus : this.isControlUsable(this.gui.mouseOver) ? this.gui.mouseOver : null;
25893
+ this.updateCursor(target, position);
25877
25894
  };
25878
25895
  _proto.controlStateChanged = function controlStateChanged(control) {
25879
25896
  if (!this.isControlUsable(control)) {
@@ -26026,11 +26043,15 @@ function getWheelDelta(event) {
26026
26043
  while(current && current !== this && this.isControlUsable(current)){
26027
26044
  var filter = current.getEffectiveMouseFilter();
26028
26045
  if (filter !== MouseFilter.Ignore) {
26029
- this.callControlInput(current, event.xformedBy(this.getGlobalInverse(current)));
26046
+ var localEvent = event.xformedBy(this.getGlobalInverse(current));
26047
+ this.callControlInput(current, localEvent);
26048
+ if (localEvent.isAccepted()) {
26049
+ event.accept();
26050
+ }
26030
26051
  }
26031
26052
  var forcePassWheel = _instanceof1(event, InputEventMouseButton) && isWheelButton(event.buttonIndex) && current.mouseForcePassScrollEvents;
26032
- if (this.inputHandled || filter === MouseFilter.Stop && pointerEvent && !forcePassWheel) {
26033
- this.inputHandled = true;
26053
+ if (event.isAccepted() || filter === MouseFilter.Stop && pointerEvent && !forcePassWheel) {
26054
+ event.accept();
26034
26055
  return;
26035
26056
  }
26036
26057
  current = current.parent;
@@ -26039,22 +26060,22 @@ function getWheelDelta(event) {
26039
26060
  _proto.callControlInput = function callControlInput(control, event) {
26040
26061
  if (_instanceof1(event, InputEventMouseButton)) {
26041
26062
  if (isWheelButton(event.buttonIndex)) {
26042
- control.onMouseWheel(event.position, getWheelDelta(event), event);
26063
+ control.onMouseWheel(event);
26043
26064
  } else if (event.isPressed()) {
26044
- control.onMouseDown(event.position, event.buttonIndex, event);
26065
+ control.onMouseDown(event);
26045
26066
  } else {
26046
- control.onMouseUp(event.position, event.buttonIndex, event);
26067
+ control.onMouseUp(event);
26047
26068
  }
26048
26069
  } else if (_instanceof1(event, InputEventMouseMotion)) {
26049
- control.onMouseMove(event.position, event);
26070
+ control.onMouseMove(event);
26050
26071
  } else if (_instanceof1(event, InputEventScreenTouch)) {
26051
26072
  if (event.isPressed()) {
26052
- control.onTouchDown(event.position, event.index, event);
26073
+ control.onTouchDown(event);
26053
26074
  } else {
26054
- control.onTouchUp(event.position, event.index, event);
26075
+ control.onTouchUp(event);
26055
26076
  }
26056
26077
  } else if (_instanceof1(event, InputEventScreenDrag)) {
26057
- control.onTouchMove(event.position, event.index, event);
26078
+ control.onTouchMove(event);
26058
26079
  } else if (_instanceof1(event, InputEventKey)) {
26059
26080
  if (event.isPressed()) {
26060
26081
  control.onKeyDown(event);
@@ -26205,11 +26226,11 @@ function getWheelDelta(event) {
26205
26226
  };
26206
26227
  _proto.updateCursor = function updateCursor(target, position) {
26207
26228
  var current = target;
26208
- var shape = CursorShape.Arrow;
26229
+ var cursor = CursorShape.Arrow;
26209
26230
  while(current && current !== this){
26210
26231
  var candidate = current.getCursorShape(this.toLocal(current, position));
26211
26232
  if (candidate !== CursorShape.Arrow) {
26212
- shape = candidate;
26233
+ cursor = candidate;
26213
26234
  break;
26214
26235
  }
26215
26236
  if (current.getEffectiveMouseFilter() === MouseFilter.Stop) {
@@ -26217,7 +26238,7 @@ function getWheelDelta(event) {
26217
26238
  }
26218
26239
  current = current.parent;
26219
26240
  }
26220
- this.engine.canvas.style.cursor = cursorNames[shape];
26241
+ this.engine.canvas.style.cursor = typeof cursor === "string" ? cursor : cursorNames[cursor];
26221
26242
  };
26222
26243
  _proto.postGrabClickFocus = function postGrabClickFocus() {
26223
26244
  var target = this.gui.mouseClickGrabber;
@@ -26869,8 +26890,8 @@ var EventSystem = /*#__PURE__*/ function() {
26869
26890
  if (!this.enabled || !this.target) {
26870
26891
  return;
26871
26892
  }
26872
- this.focusTarget();
26873
26893
  var position = this.getCanvasPosition(event.clientX, event.clientY);
26894
+ this.focusTarget();
26874
26895
  var state = this.createPointerState(position);
26875
26896
  this.mouseState = state;
26876
26897
  state.pressed = true;
@@ -27162,12 +27183,14 @@ var EventSystem = /*#__PURE__*/ function() {
27162
27183
  var _target_width, _target_height;
27163
27184
  return {
27164
27185
  x: position.x / cssWidth * 2 - 1,
27165
- y: position.y / cssHeight * 2 - 1,
27186
+ // Legacy composition picking uses bottom-left, Y-up NDC even though GUI
27187
+ // input follows the DOM convention of top-left, Y-down pixels.
27188
+ y: 1 - position.y / cssHeight * 2,
27166
27189
  vx: velocity.x / cssWidth * 2,
27167
- vy: velocity.y / cssHeight * 2,
27190
+ vy: -velocity.y / cssHeight * 2,
27168
27191
  ts: performance.now(),
27169
27192
  dx: (position.x - state.start.x) / cssWidth * 2,
27170
- dy: (position.y - state.start.y) / cssHeight * 2,
27193
+ dy: -(position.y - state.start.y) / cssHeight * 2,
27171
27194
  width: (_target_width = target == null ? void 0 : target.width) != null ? _target_width : 0,
27172
27195
  height: (_target_height = target == null ? void 0 : target.height) != null ? _target_height : 0,
27173
27196
  origin: origin
@@ -27179,7 +27202,7 @@ var EventSystem = /*#__PURE__*/ function() {
27179
27202
  if (!rect) {
27180
27203
  return new Vector2();
27181
27204
  }
27182
- return new Vector2(clientX - rect.left, rect.bottom - clientY);
27205
+ return new Vector2(clientX - rect.left, clientY - rect.top);
27183
27206
  };
27184
27207
  _proto.consumeNativeEvent = function consumeNativeEvent(event, handled) {
27185
27208
  if (handled && !this.allowPropagation) {
@@ -27195,9 +27218,8 @@ var EventSystem = /*#__PURE__*/ function() {
27195
27218
  }
27196
27219
  };
27197
27220
  _proto.focusTarget = function focusTarget() {
27198
- if (this.target && document.activeElement !== this.target) {
27199
- this.target.focus();
27200
- }
27221
+ var _this_target;
27222
+ (_this_target = this.target) == null ? void 0 : _this_target.focus();
27201
27223
  };
27202
27224
  _proto.addNativeHandler = function addNativeHandler(target, name, handler, options) {
27203
27225
  target.addEventListener(name, handler, options);
@@ -39334,7 +39356,7 @@ function getStandardSpriteContent(sprite, transform) {
39334
39356
  return ret;
39335
39357
  }
39336
39358
 
39337
- var version$2 = "2.10.0-alpha.3";
39359
+ var version$2 = "2.10.0-alpha.4";
39338
39360
  var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
39339
39361
  var standardVersion = /^(\d+)\.(\d+)$/;
39340
39362
  var reverseParticle = false;
@@ -44564,7 +44586,7 @@ registerPlugin("text", TextLoader);
44564
44586
  registerPlugin("sprite", SpriteLoader);
44565
44587
  registerPlugin("particle", ParticleLoader);
44566
44588
  registerPlugin("interact", InteractLoader);
44567
- var version$1 = "2.10.0-alpha.3";
44589
+ var version$1 = "2.10.0-alpha.4";
44568
44590
  logger.info("Core version: " + version$1 + ".");
44569
44591
 
44570
44592
  var _obj;
@@ -46057,7 +46079,7 @@ applyMixins(ThreeTextComponent, [
46057
46079
  */ Mesh.create = function(engine, props) {
46058
46080
  return new ThreeMesh(engine, props);
46059
46081
  };
46060
- var version = "2.10.0-alpha.3";
46082
+ var version = "2.10.0-alpha.4";
46061
46083
  logger.info("THREEJS plugin version: " + version + ".");
46062
46084
 
46063
46085
  export { ATLAS_SIZE, ActivationMixerPlayable, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AndNode, AndNodeData, Animatable, AnimationClip, AnimationClipNode, AnimationClipNodeData, AnimationEvent, AnimationGraphAsset, Animator, ApplyAdditiveNode, ApplyAdditiveNodeData, Asset, AssetLoader, AssetManager, AssetService, BYTES_TYPE_MAP, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BezierDataMap, BezierEasing, BezierLengthData, BezierMap, BezierPath, BezierQuat, BinaryAsset, BlendNode, BlendNodeData, BoolValueNode, BoundingBoxInfo, Buffer, BufferDataType, BufferUsage, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, Camera, CameraController, CameraVFXItemLoader, CanvasContainer, CanvasRenderMode, CanvasRootControl, Circle$1 as Circle, ColorCurve, ColorPlayable, ColorPropertyMixerPlayable, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, ComponentTimePlayable, ComponentTimePlayableAsset, ComponentTimeTrack, Composition, CompositionComponent, CompressTextureCapabilityType, ConstBoolNode, ConstBoolNodeData, ConstFloatNode, ConstFloatNodeData, ConstraintTarget, ContainerControl, Control, ControlParameterBoolNode, ControlParameterBoolNodeData, ControlParameterFloatNode, ControlParameterFloatNodeData, ControlParameterTriggerNode, ControlParameterTriggerNodeData, CursorShape, DEFAULT_FONTS, DEFAULT_FPS, DataBuffer, Database, Deferred, DestroyOptions, Downloader, DrawObjectPass, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectComponentTimeTrack, EffectsObject, EffectsPackage, Ellipse, Engine, EqualNodeData, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatComparisonNode, FloatComparisonNodeData, FloatPropertyMixerPlayable, FloatPropertyPlayableAsset, FloatPropertyTrack, FloatValueNode, FocusBehaviorRecursive, FocusMode, FrameComponent, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GlyphAtlas, GradientValue, GraphInstance, GraphNode, GraphNodeData, Graphics, GreaterNodeData, HELP_LINK, HitTestType, InputEvent, InputEventKey, InputEventMouse, InputEventMouseButton, InputEventMouseMotion, InputEventScreenDrag, InputEventScreenTouch, InputEventWithModifiers, InteractComponent, InteractLoader, InteractMesh, InvalidIndex, Item, KeyLocation, LayerBlendNode, LayerBlendNodeData, LessNodeData, LineSegments, LinearValue, MaskMode, MaskProcessor, MaskableGraphic, Material, MaterialDataBlock, MaterialRenderType, MaterialState, MaterialTrack, Mesh, MouseBehaviorRecursive, MouseButton, MouseButtonMask, MouseFilter, NodeTransform, NotNode, NotNodeData, NotifyEvent, ObjectBindingTrack, OrNode, OrNodeData, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleMixerPlayable, ParticleSystem, ParticleSystemRenderer, ParticleTrack, PassTextureCache, PathSegments, PlayState, Playable, PlayableAsset, PlayableOutput, Plugin, PluginSystem, PointerEventData, PointerEventType, PolyStar, Polygon, Pose, PoseNode, PositionConstraint, PostProcessVolume, Precomposition, PrecompositionManager, PropertyClipPlayable, PropertyTrack, REFERENCE_CURVE, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RaycastResult, Rectangle$1 as Rectangle, ReferenceCurve, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTargetPool, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RootControl, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SceneLoader, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, SourceType, Sprite, SpriteColorMixerPlayable, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteComponentTimeTrack, SpriteLoader, SpritePropertyMixerPlayable, SpritePropertyPlayableAsset, SpritePropertyTrack, SpriteRotation, StarType, StateMachineNode, StateMachineNodeData, StateNode, StateNodeData, StaticValue, SubCompositionClipPlayable, SubCompositionMixerPlayable, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TEXTURE_UNIFORM_MAP, TangentMode, TextCache, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TexturePaintScaleMode, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTextComponent, ThreeTexture, Ticker, TimelineAsset, TimelineClip, TimelineInstance, TrackAsset, TrackMixerPlayable, TrackType, Transform, TransformMixerPlayable, TransformPlayable, TransformPlayableAsset, TransformTrack, TransitionNode, TransitionNodeData, TransitionState, Triangle, TrimPath, TrimPathMode, UICanvas, UIControl, UpdateModes, VFXItem, ValueGetter, ValueNode, Vector2Curve, Vector2PropertyMixerPlayable, Vector2PropertyPlayableAsset, Vector2PropertyTrack, Vector3Curve, Vector3PropertyMixerPlayable, Vector3PropertyTrack, Vector3ropertyPlayableAsset, Vector4Curve, Vector4PropertyMixerPlayable, Vector4PropertyPlayableAsset, Vector4PropertyTrack, VertexBuffer, WeightedMode, WindowRootControl, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, breakOpportunityAfter, buildBezierData, buildEasingCurve, buildLine, calculateTranslation, canUseBOM, canvasPool, closePointEps, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createGLContext, createKeyFrameMeta, createShape, createTypedArray, createValueGetter, curveEps, decimalEqual, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, extractMinAndMax, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTexture, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateWhiteTexture, getBackgroundImage, getBytesPerElement, getClass, getColorFromGradientStops, getConfig, getControlPoints, getDataByteLength, getDataType, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getKeyFrameMetaByRawValue, getMergedStore, getNodeDataClass, getParticleMeshShader, getPixelRatio, getPluginUsageInfo, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isBreakChar, isCJKLike, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isOpenHarmony, isPlainObject, isPowerOfTwo, isSafeFontFamily, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, modifyMaxKeyframeShader, nearestPowerOfTwo, nodeDataClass, noop, normalizeColor, numberToFix, oldBezierKeyFramesToNew, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setRayFromCamera, setSideMode, setUniformValue, sortByOrder, index$1 as spec, textureLoaderRegistry, thresholdFrag, throwDestroyedError, toBufferView, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };