@galacean/effects-core 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 core 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';
@@ -2665,6 +2665,11 @@ function asserts(condition, msg) {
2665
2665
  * @returns
2666
2666
  */ function isValidFontFamily(fontFamily) {
2667
2667
  // iOS 11/12 不支持自定义字体开头为数字的名称,特殊字符也有风险
2668
+ return isSafeFontFamily(fontFamily) || !isSimulatorCellPhone();
2669
+ }
2670
+ /**
2671
+ * @internal
2672
+ */ function isSafeFontFamily(fontFamily) {
2668
2673
  return /^[^\d.][\w-]*$/.test(fontFamily);
2669
2674
  }
2670
2675
 
@@ -23505,8 +23510,20 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
23505
23510
  this.destroyed = false;
23506
23511
  };
23507
23512
  _proto.onStart = function onStart() {
23513
+ var _this = this;
23508
23514
  this.startEmit();
23509
23515
  this.initEmitterTransform();
23516
+ this.item.on("click", function() {
23517
+ var _this_interaction;
23518
+ if (((_this_interaction = _this.interaction) == null ? void 0 : _this_interaction.behavior) === ParticleInteractionBehavior.removeParticle) {
23519
+ var pointIndex = _this.clickedPoint.content[1];
23520
+ _this.renderer.removeParticlePoint(pointIndex);
23521
+ _this.clearPointTrail(pointIndex);
23522
+ _this.clickedPoint.content = [
23523
+ 0
23524
+ ];
23525
+ }
23526
+ });
23510
23527
  };
23511
23528
  _proto.onUpdate = function onUpdate(dt) {
23512
23529
  this.update(dt);
@@ -23609,7 +23626,10 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
23609
23626
  this.particleLink.forEach(function(content) {
23610
23627
  content[0] -= duration;
23611
23628
  content[2] -= duration;
23612
- content[3].delay -= duration;
23629
+ // TODO 优化粒子销毁逻辑
23630
+ if (content[3]) {
23631
+ content[3].delay -= duration;
23632
+ }
23613
23633
  });
23614
23634
  this.renderer.minusTimeForLoop(duration);
23615
23635
  } else {
@@ -23701,7 +23721,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
23701
23721
  var finish = false;
23702
23722
  if (node && node.content) {
23703
23723
  do {
23704
- var _node_content = node.content, currentTime = _node_content[0], pointIndex = _node_content[1]; _node_content[2]; var point = _node_content[3];
23724
+ var _node_content = node.content, currentTime = _node_content[0]; _node_content[2]; var point = _node_content[3];
23705
23725
  if (currentTime > this.timePassed) {
23706
23726
  var pos = this.getPointPosition(point);
23707
23727
  var ray = options.ray;
@@ -23713,13 +23733,7 @@ exports.ParticleSystem = /*#__PURE__*/ function(Component) {
23713
23733
  }, temp);
23714
23734
  }
23715
23735
  if (pass) {
23716
- if (options.removeParticle) {
23717
- renderer.removeParticlePoint(pointIndex);
23718
- this.clearPointTrail(pointIndex);
23719
- node.content = [
23720
- 0
23721
- ];
23722
- }
23736
+ this.clickedPoint = node;
23723
23737
  hitPositions.push(pos);
23724
23738
  if (!options.multiple) {
23725
23739
  finish = true;
@@ -29338,7 +29352,8 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
29338
29352
  var fontSize = style.fontSize * fontScale;
29339
29353
  var lineHeight = layout.lineHeight * fontScale;
29340
29354
  style.fontDesc = this.getFontDesc(fontSize);
29341
- var char = (this.text || "").split("");
29355
+ // 使用 Array.from 正确分割 Unicode 字符(包括 emoji)
29356
+ var char = Array.from(this.text || "");
29342
29357
  var baseHeight = 0;
29343
29358
  if (layout.autoWidth) {
29344
29359
  baseHeight = finalHeight * fontScale;
@@ -29406,7 +29421,7 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
29406
29421
  charOffsetX: charOffsetX
29407
29422
  });
29408
29423
  // 先描边
29409
- if (style.isOutlined) {
29424
+ if (style.isOutlined && style.outlineWidth > 0) {
29410
29425
  charsInfo.forEach(function(charInfo) {
29411
29426
  var ox = layout.getOffsetX(style, charInfo.width);
29412
29427
  for(var i = 0; i < charInfo.chars.length; i++){
@@ -31610,7 +31625,7 @@ function getStandardSpriteContent(sprite, transform) {
31610
31625
  return ret;
31611
31626
  }
31612
31627
 
31613
- var version$1 = "2.8.3";
31628
+ var version$1 = "2.8.5";
31614
31629
  var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
31615
31630
  var standardVersion = /^(\d+)\.(\d+)$/;
31616
31631
  var reverseParticle = false;
@@ -35310,7 +35325,7 @@ registerPlugin("text", TextLoader);
35310
35325
  registerPlugin("sprite", SpriteLoader);
35311
35326
  registerPlugin("particle", ParticleLoader);
35312
35327
  registerPlugin("interact", InteractLoader);
35313
- var version = "2.8.3";
35328
+ var version = "2.8.5";
35314
35329
  logger.info("Core version: " + version + ".");
35315
35330
 
35316
35331
  exports.ActivationMixerPlayable = ActivationMixerPlayable;
@@ -35555,6 +35570,7 @@ exports.isObject = isObject;
35555
35570
  exports.isOpenHarmony = isOpenHarmony;
35556
35571
  exports.isPlainObject = isPlainObject;
35557
35572
  exports.isPowerOfTwo = isPowerOfTwo;
35573
+ exports.isSafeFontFamily = isSafeFontFamily;
35558
35574
  exports.isSimulatorCellPhone = isSimulatorCellPhone;
35559
35575
  exports.isString = isString;
35560
35576
  exports.isUniformStruct = isUniformStruct;