@galacean/effects-threejs 1.5.0 → 1.6.0-beta.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.
package/dist/index.js 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: v1.5.0
6
+ * Version: v1.6.0-beta.0
7
7
  */
8
8
 
9
9
  'use strict';
@@ -724,7 +724,7 @@ function isValidFontFamily(fontFamily) {
724
724
  * Name: @galacean/effects-specification
725
725
  * Description: Galacean Effects JSON Specification
726
726
  * Author: Ant Group CO., Ltd.
727
- * Version: v1.3.0-alpha.0
727
+ * Version: v1.3.0
728
728
  */
729
729
 
730
730
  /*********************************************/
@@ -10095,10 +10095,23 @@ var EventSystem = /** @class */ (function () {
10095
10095
  var getTouchEventValue = function (event, x, y, dx, dy) {
10096
10096
  if (dx === void 0) { dx = 0; }
10097
10097
  if (dy === void 0) { dy = 0; }
10098
- var _a = _this.target, width = _a.width, height = _a.height;
10099
- var ts = performance.now();
10100
10098
  var vx = 0;
10101
10099
  var vy = 0;
10100
+ var ts = performance.now();
10101
+ if (!_this.target) {
10102
+ logger.error('Trigger TouchEvent after EventSystem is disposed');
10103
+ return {
10104
+ x: x,
10105
+ y: y,
10106
+ vx: 0,
10107
+ vy: vy,
10108
+ dx: dx,
10109
+ dy: dy,
10110
+ ts: ts,
10111
+ width: 0, height: 0, origin: event,
10112
+ };
10113
+ }
10114
+ var _a = _this.target, width = _a.width, height = _a.height;
10102
10115
  if (lastTouch) {
10103
10116
  var dt = ts - lastTouch.ts;
10104
10117
  vx = ((dx - lastTouch.dx) / dt) || 0;
@@ -13633,10 +13646,13 @@ var InteractVFXItem = /** @class */ (function (_super) {
13633
13646
  var dragEvent;
13634
13647
  var handlerMap = {
13635
13648
  touchstart: function (event) {
13636
- var _a;
13649
+ var _a, _b;
13650
+ if (!((_a = _this.composition) === null || _a === void 0 ? void 0 : _a.interactive)) {
13651
+ return;
13652
+ }
13637
13653
  _this.dragEvent = null;
13638
13654
  _this.bouncingArg = null;
13639
- var camera = (_a = _this.composition) === null || _a === void 0 ? void 0 : _a.camera;
13655
+ var camera = (_b = _this.composition) === null || _b === void 0 ? void 0 : _b.camera;
13640
13656
  dragEvent = {
13641
13657
  x: event.x,
13642
13658
  y: event.y,
@@ -13651,6 +13667,10 @@ var InteractVFXItem = /** @class */ (function (_super) {
13651
13667
  _this.bouncingArg = event;
13652
13668
  },
13653
13669
  touchend: function (event) {
13670
+ var _a;
13671
+ if (!((_a = _this.composition) === null || _a === void 0 ? void 0 : _a.interactive)) {
13672
+ return;
13673
+ }
13654
13674
  var bouncingArg = _this.bouncingArg;
13655
13675
  if (!shouldIgnoreBouncing(bouncingArg, 3) && bouncingArg) {
13656
13676
  var speed = 5;
@@ -13675,12 +13695,12 @@ var InteractVFXItem = /** @class */ (function (_super) {
13675
13695
  // OVERRIDE
13676
13696
  };
13677
13697
  InteractVFXItem.prototype.handleDragMove = function (evt, event) {
13678
- var _a, _b;
13679
- if (!(evt && evt.cameraParam) || !this.composition) {
13698
+ var _a, _b, _c;
13699
+ if (!(evt && evt.cameraParam) || !((_a = this.composition) === null || _a === void 0 ? void 0 : _a.interactive)) {
13680
13700
  return;
13681
13701
  }
13682
13702
  var options = this.ui.options;
13683
- var _c = evt.cameraParam, position = _c.position, fov = _c.fov;
13703
+ var _d = evt.cameraParam, position = _d.position, fov = _d.fov;
13684
13704
  var dy = event.dy;
13685
13705
  var dx = event.dx * event.width / event.height;
13686
13706
  var depth = position[2];
@@ -13690,17 +13710,17 @@ var InteractVFXItem = /** @class */ (function (_super) {
13690
13710
  var nx = position[0] - width;
13691
13711
  var ny = position[1] - height;
13692
13712
  if (options.dxRange) {
13693
- var _d = __read$3(options.dxRange, 2), min = _d[0], max = _d[1];
13713
+ var _e = __read$3(options.dxRange, 2), min = _e[0], max = _e[1];
13694
13714
  nx = clamp$1(nx, min, max);
13695
13715
  if (nx !== min && nx !== max && min !== max) {
13696
- (_a = event.origin) === null || _a === void 0 ? void 0 : _a.preventDefault();
13716
+ (_b = event.origin) === null || _b === void 0 ? void 0 : _b.preventDefault();
13697
13717
  }
13698
13718
  }
13699
13719
  if (options.dyRange) {
13700
- var _e = __read$3(options.dyRange, 2), min = _e[0], max = _e[1];
13720
+ var _f = __read$3(options.dyRange, 2), min = _f[0], max = _f[1];
13701
13721
  ny = clamp$1(ny, min, max);
13702
13722
  if (ny !== min && ny !== max && min !== max) {
13703
- (_b = event.origin) === null || _b === void 0 ? void 0 : _b.preventDefault();
13723
+ (_c = event.origin) === null || _c === void 0 ? void 0 : _c.preventDefault();
13704
13724
  }
13705
13725
  }
13706
13726
  this.composition.camera.position = new Vector3(nx, ny, depth);
@@ -21905,7 +21925,7 @@ var filters = {
21905
21925
  * Name: @galacean/effects-specification
21906
21926
  * Description: Galacean Effects JSON Specification
21907
21927
  * Author: Ant Group CO., Ltd.
21908
- * Version: v1.3.0-alpha.0
21928
+ * Version: v1.3.0
21909
21929
  */
21910
21930
 
21911
21931
  /*********************************************/
@@ -25049,6 +25069,7 @@ var Composition = /** @class */ (function () {
25049
25069
  this.camera = new Camera(this.name, __assign$1(__assign$1({}, sourceContent === null || sourceContent === void 0 ? void 0 : sourceContent.camera), { aspect: width / height }));
25050
25070
  this.url = scene.url;
25051
25071
  this.assigned = true;
25072
+ this.interactive = true;
25052
25073
  this.onPlayerPause = onPlayerPause;
25053
25074
  this.onMessageItem = onMessageItem;
25054
25075
  this.onEnd = onEnd;
@@ -25428,7 +25449,7 @@ var Composition = /** @class */ (function () {
25428
25449
  * @param options - 最大求交数和求交时的回调
25429
25450
  */
25430
25451
  Composition.prototype.hitTest = function (x, y, force, options) {
25431
- if (this.isDestroyed) {
25452
+ if (this.isDestroyed || !this.interactive) {
25432
25453
  return [];
25433
25454
  }
25434
25455
  var regions = [];
@@ -27426,7 +27447,7 @@ Geometry.create = function (engine, options) {
27426
27447
  Mesh.create = function (engine, props) {
27427
27448
  return new ThreeMesh(engine, props);
27428
27449
  };
27429
- var version = "1.5.0";
27450
+ var version = "1.6.0-beta.0";
27430
27451
  logger.info('THREEJS plugin version: ' + version);
27431
27452
 
27432
27453
  exports.AbstractPlugin = AbstractPlugin;