@galacean/effects-threejs 2.8.3 → 2.8.5

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: v2.8.3
6
+ * Version: v2.8.5
7
7
  */
8
8
 
9
9
  'use strict';
@@ -2687,6 +2687,11 @@ function asserts(condition, msg) {
2687
2687
  * @returns
2688
2688
  */ function isValidFontFamily(fontFamily) {
2689
2689
  // iOS 11/12 不支持自定义字体开头为数字的名称,特殊字符也有风险
2690
+ return isSafeFontFamily(fontFamily) || !isSimulatorCellPhone();
2691
+ }
2692
+ /**
2693
+ * @internal
2694
+ */ function isSafeFontFamily(fontFamily) {
2690
2695
  return /^[^\d.][\w-]*$/.test(fontFamily);
2691
2696
  }
2692
2697
 
@@ -23527,8 +23532,20 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
23527
23532
  this.destroyed = false;
23528
23533
  };
23529
23534
  _proto.onStart = function onStart() {
23535
+ var _this = this;
23530
23536
  this.startEmit();
23531
23537
  this.initEmitterTransform();
23538
+ this.item.on("click", function() {
23539
+ var _this_interaction;
23540
+ if (((_this_interaction = _this.interaction) == null ? void 0 : _this_interaction.behavior) === ParticleInteractionBehavior.removeParticle) {
23541
+ var pointIndex = _this.clickedPoint.content[1];
23542
+ _this.renderer.removeParticlePoint(pointIndex);
23543
+ _this.clearPointTrail(pointIndex);
23544
+ _this.clickedPoint.content = [
23545
+ 0
23546
+ ];
23547
+ }
23548
+ });
23532
23549
  };
23533
23550
  _proto.onUpdate = function onUpdate(dt) {
23534
23551
  this.update(dt);
@@ -23631,7 +23648,10 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
23631
23648
  this.particleLink.forEach(function(content) {
23632
23649
  content[0] -= duration;
23633
23650
  content[2] -= duration;
23634
- content[3].delay -= duration;
23651
+ // TODO 优化粒子销毁逻辑
23652
+ if (content[3]) {
23653
+ content[3].delay -= duration;
23654
+ }
23635
23655
  });
23636
23656
  this.renderer.minusTimeForLoop(duration);
23637
23657
  } else {
@@ -23723,7 +23743,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
23723
23743
  var finish = false;
23724
23744
  if (node && node.content) {
23725
23745
  do {
23726
- var _node_content = node.content, currentTime = _node_content[0], pointIndex = _node_content[1]; _node_content[2]; var point = _node_content[3];
23746
+ var _node_content = node.content, currentTime = _node_content[0]; _node_content[2]; var point = _node_content[3];
23727
23747
  if (currentTime > this.timePassed) {
23728
23748
  var pos = this.getPointPosition(point);
23729
23749
  var ray = options.ray;
@@ -23735,13 +23755,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
23735
23755
  }, temp);
23736
23756
  }
23737
23757
  if (pass) {
23738
- if (options.removeParticle) {
23739
- renderer.removeParticlePoint(pointIndex);
23740
- this.clearPointTrail(pointIndex);
23741
- node.content = [
23742
- 0
23743
- ];
23744
- }
23758
+ this.clickedPoint = node;
23745
23759
  hitPositions.push(pos);
23746
23760
  if (!options.multiple) {
23747
23761
  finish = true;
@@ -29360,7 +29374,8 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
29360
29374
  var fontSize = style.fontSize * fontScale;
29361
29375
  var lineHeight = layout.lineHeight * fontScale;
29362
29376
  style.fontDesc = this.getFontDesc(fontSize);
29363
- var char = (this.text || "").split("");
29377
+ // 使用 Array.from 正确分割 Unicode 字符(包括 emoji)
29378
+ var char = Array.from(this.text || "");
29364
29379
  var baseHeight = 0;
29365
29380
  if (layout.autoWidth) {
29366
29381
  baseHeight = finalHeight * fontScale;
@@ -29428,7 +29443,7 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
29428
29443
  charOffsetX: charOffsetX
29429
29444
  });
29430
29445
  // 先描边
29431
- if (style.isOutlined) {
29446
+ if (style.isOutlined && style.outlineWidth > 0) {
29432
29447
  charsInfo.forEach(function(charInfo) {
29433
29448
  var ox = layout.getOffsetX(style, charInfo.width);
29434
29449
  for(var i = 0; i < charInfo.chars.length; i++){
@@ -31632,7 +31647,7 @@ function getStandardSpriteContent(sprite, transform) {
31632
31647
  return ret;
31633
31648
  }
31634
31649
 
31635
- var version$2 = "2.8.3";
31650
+ var version$2 = "2.8.5";
31636
31651
  var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
31637
31652
  var standardVersion = /^(\d+)\.(\d+)$/;
31638
31653
  var reverseParticle = false;
@@ -35332,7 +35347,7 @@ registerPlugin("text", TextLoader);
35332
35347
  registerPlugin("sprite", SpriteLoader);
35333
35348
  registerPlugin("particle", ParticleLoader);
35334
35349
  registerPlugin("interact", InteractLoader);
35335
- var version$1 = "2.8.3";
35350
+ var version$1 = "2.8.5";
35336
35351
  logger.info("Core version: " + version$1 + ".");
35337
35352
 
35338
35353
  var _obj;
@@ -36909,7 +36924,7 @@ applyMixins(exports.ThreeTextComponent, [
36909
36924
  */ Mesh.create = function(engine, props) {
36910
36925
  return new ThreeMesh(engine, props);
36911
36926
  };
36912
- var version = "2.8.3";
36927
+ var version = "2.8.5";
36913
36928
  logger.info("THREEJS plugin version: " + version + ".");
36914
36929
 
36915
36930
  exports.ActivationMixerPlayable = ActivationMixerPlayable;
@@ -37164,6 +37179,7 @@ exports.isObject = isObject;
37164
37179
  exports.isOpenHarmony = isOpenHarmony;
37165
37180
  exports.isPlainObject = isPlainObject;
37166
37181
  exports.isPowerOfTwo = isPowerOfTwo;
37182
+ exports.isSafeFontFamily = isSafeFontFamily;
37167
37183
  exports.isSimulatorCellPhone = isSimulatorCellPhone;
37168
37184
  exports.isString = isString;
37169
37185
  exports.isUniformStruct = isUniformStruct;