@galacean/effects 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/alipay.js CHANGED
@@ -696,7 +696,7 @@ function isValidFontFamily(fontFamily) {
696
696
  * Name: @galacean/effects-specification
697
697
  * Description: Galacean Effects JSON Specification
698
698
  * Author: Ant Group CO., Ltd.
699
- * Version: v1.3.0-alpha.0
699
+ * Version: v1.3.0
700
700
  */
701
701
 
702
702
  /*********************************************/
@@ -10067,10 +10067,23 @@ var EventSystem = /** @class */ (function () {
10067
10067
  var getTouchEventValue = function (event, x, y, dx, dy) {
10068
10068
  if (dx === void 0) { dx = 0; }
10069
10069
  if (dy === void 0) { dy = 0; }
10070
- var _a = _this.target, width = _a.width, height = _a.height;
10071
- var ts = alipay.performance.now();
10072
10070
  var vx = 0;
10073
10071
  var vy = 0;
10072
+ var ts = alipay.performance.now();
10073
+ if (!_this.target) {
10074
+ logger.error('Trigger TouchEvent after EventSystem is disposed');
10075
+ return {
10076
+ x: x,
10077
+ y: y,
10078
+ vx: 0,
10079
+ vy: vy,
10080
+ dx: dx,
10081
+ dy: dy,
10082
+ ts: ts,
10083
+ width: 0, height: 0, origin: event,
10084
+ };
10085
+ }
10086
+ var _a = _this.target, width = _a.width, height = _a.height;
10074
10087
  if (lastTouch) {
10075
10088
  var dt = ts - lastTouch.ts;
10076
10089
  vx = ((dx - lastTouch.dx) / dt) || 0;
@@ -13605,10 +13618,13 @@ var InteractVFXItem = /** @class */ (function (_super) {
13605
13618
  var dragEvent;
13606
13619
  var handlerMap = {
13607
13620
  touchstart: function (event) {
13608
- var _a;
13621
+ var _a, _b;
13622
+ if (!((_a = _this.composition) === null || _a === void 0 ? void 0 : _a.interactive)) {
13623
+ return;
13624
+ }
13609
13625
  _this.dragEvent = null;
13610
13626
  _this.bouncingArg = null;
13611
- var camera = (_a = _this.composition) === null || _a === void 0 ? void 0 : _a.camera;
13627
+ var camera = (_b = _this.composition) === null || _b === void 0 ? void 0 : _b.camera;
13612
13628
  dragEvent = {
13613
13629
  x: event.x,
13614
13630
  y: event.y,
@@ -13623,6 +13639,10 @@ var InteractVFXItem = /** @class */ (function (_super) {
13623
13639
  _this.bouncingArg = event;
13624
13640
  },
13625
13641
  touchend: function (event) {
13642
+ var _a;
13643
+ if (!((_a = _this.composition) === null || _a === void 0 ? void 0 : _a.interactive)) {
13644
+ return;
13645
+ }
13626
13646
  var bouncingArg = _this.bouncingArg;
13627
13647
  if (!shouldIgnoreBouncing(bouncingArg, 3) && bouncingArg) {
13628
13648
  var speed = 5;
@@ -13647,12 +13667,12 @@ var InteractVFXItem = /** @class */ (function (_super) {
13647
13667
  // OVERRIDE
13648
13668
  };
13649
13669
  InteractVFXItem.prototype.handleDragMove = function (evt, event) {
13650
- var _a, _b;
13651
- if (!(evt && evt.cameraParam) || !this.composition) {
13670
+ var _a, _b, _c;
13671
+ if (!(evt && evt.cameraParam) || !((_a = this.composition) === null || _a === void 0 ? void 0 : _a.interactive)) {
13652
13672
  return;
13653
13673
  }
13654
13674
  var options = this.ui.options;
13655
- var _c = evt.cameraParam, position = _c.position, fov = _c.fov;
13675
+ var _d = evt.cameraParam, position = _d.position, fov = _d.fov;
13656
13676
  var dy = event.dy;
13657
13677
  var dx = event.dx * event.width / event.height;
13658
13678
  var depth = position[2];
@@ -13662,17 +13682,17 @@ var InteractVFXItem = /** @class */ (function (_super) {
13662
13682
  var nx = position[0] - width;
13663
13683
  var ny = position[1] - height;
13664
13684
  if (options.dxRange) {
13665
- var _d = __read$3(options.dxRange, 2), min = _d[0], max = _d[1];
13685
+ var _e = __read$3(options.dxRange, 2), min = _e[0], max = _e[1];
13666
13686
  nx = clamp$1(nx, min, max);
13667
13687
  if (nx !== min && nx !== max && min !== max) {
13668
- (_a = event.origin) === null || _a === void 0 ? void 0 : _a.preventDefault();
13688
+ (_b = event.origin) === null || _b === void 0 ? void 0 : _b.preventDefault();
13669
13689
  }
13670
13690
  }
13671
13691
  if (options.dyRange) {
13672
- var _e = __read$3(options.dyRange, 2), min = _e[0], max = _e[1];
13692
+ var _f = __read$3(options.dyRange, 2), min = _f[0], max = _f[1];
13673
13693
  ny = clamp$1(ny, min, max);
13674
13694
  if (ny !== min && ny !== max && min !== max) {
13675
- (_b = event.origin) === null || _b === void 0 ? void 0 : _b.preventDefault();
13695
+ (_c = event.origin) === null || _c === void 0 ? void 0 : _c.preventDefault();
13676
13696
  }
13677
13697
  }
13678
13698
  this.composition.camera.position = new Vector3(nx, ny, depth);
@@ -21877,7 +21897,7 @@ var filters = {
21877
21897
  * Name: @galacean/effects-specification
21878
21898
  * Description: Galacean Effects JSON Specification
21879
21899
  * Author: Ant Group CO., Ltd.
21880
- * Version: v1.3.0-alpha.0
21900
+ * Version: v1.3.0
21881
21901
  */
21882
21902
 
21883
21903
  /*********************************************/
@@ -25021,6 +25041,7 @@ var Composition = /** @class */ (function () {
25021
25041
  this.camera = new Camera(this.name, __assign$1(__assign$1({}, sourceContent === null || sourceContent === void 0 ? void 0 : sourceContent.camera), { aspect: width / height }));
25022
25042
  this.url = scene.url;
25023
25043
  this.assigned = true;
25044
+ this.interactive = true;
25024
25045
  this.onPlayerPause = onPlayerPause;
25025
25046
  this.onMessageItem = onMessageItem;
25026
25047
  this.onEnd = onEnd;
@@ -25400,7 +25421,7 @@ var Composition = /** @class */ (function () {
25400
25421
  * @param options - 最大求交数和求交时的回调
25401
25422
  */
25402
25423
  Composition.prototype.hitTest = function (x, y, force, options) {
25403
- if (this.isDestroyed) {
25424
+ if (this.isDestroyed || !this.interactive) {
25404
25425
  return [];
25405
25426
  }
25406
25427
  var regions = [];
@@ -30172,7 +30193,12 @@ var Player = /** @class */ (function () {
30172
30193
  for (var i = 0; i < regions.length; i++) {
30173
30194
  var behavior = regions[i].behavior || InteractBehavior$2.NOTIFY;
30174
30195
  if (behavior === InteractBehavior$2.NOTIFY) {
30175
- (_a = _this.handleItemClicked) === null || _a === void 0 ? void 0 : _a.call(_this, __assign$1(__assign$1({}, regions[i]), { composition: composition.name, player: _this }));
30196
+ if (composition.onItemClicked) {
30197
+ composition.onItemClicked(__assign$1({}, regions[i]));
30198
+ }
30199
+ else {
30200
+ (_a = _this.handleItemClicked) === null || _a === void 0 ? void 0 : _a.call(_this, __assign$1(__assign$1({}, regions[i]), { compositionId: composition.id, compositionName: composition.name, composition: composition.name, player: _this }));
30201
+ }
30176
30202
  }
30177
30203
  else if (behavior === InteractBehavior$2.RESUME_PLAYER) {
30178
30204
  void _this.resume();
@@ -30935,7 +30961,7 @@ Renderer.create = function (canvas, framework, renderOptions) {
30935
30961
  Engine.create = function (gl) {
30936
30962
  return new GLEngine(gl);
30937
30963
  };
30938
- var version = "1.5.0";
30964
+ var version = "1.6.0-beta.0";
30939
30965
  logger.info('player version: ' + version);
30940
30966
 
30941
30967
  exports.AbstractPlugin = AbstractPlugin;