@galacean/effects-threejs 2.5.4 → 2.5.6

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.5.4
6
+ * Version: v2.5.6
7
7
  */
8
8
 
9
9
  'use strict';
@@ -488,6 +488,8 @@ function getPixelRatio() {
488
488
  }
489
489
  return 1;
490
490
  }
491
+ // window 对象不存在时需要判断
492
+ var canUseBOM = typeof window !== "undefined";
491
493
  function isIOS() {
492
494
  // real ios device not in simulator
493
495
  return !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);
@@ -5938,6 +5940,8 @@ function gpuTimer(gl) {
5938
5940
 
5939
5941
  var initErrors = [];
5940
5942
  var glContext = {};
5943
+ var IOS16_LOCKDOWN_MODE = "iOS16 lockdown mode, WebGL Constants not in global";
5944
+ var WEBGL_CONSTANTS_NOT_IN_GLOBAL = "WebGL Constants not in global, please check your environment";
5941
5945
  if (!initErrors.length) {
5942
5946
  initGLContext();
5943
5947
  }
@@ -5949,8 +5953,12 @@ function initGLContext() {
5949
5953
  copy(WebGLRenderingContext);
5950
5954
  copy(WebGLRenderingContext.prototype);
5951
5955
  } else {
5952
- initErrors.push(isIOS() ? // iOS 16 lockdown mode
5953
- "iOS16 lockdown mode, WebGL Constants not in global" : "WebGL Constants not in global, please check your environment");
5956
+ if (canUseBOM) {
5957
+ initErrors.push(// iOS 16 lockdown mode
5958
+ isIOS() ? IOS16_LOCKDOWN_MODE : WEBGL_CONSTANTS_NOT_IN_GLOBAL);
5959
+ } else {
5960
+ initErrors.push(WEBGL_CONSTANTS_NOT_IN_GLOBAL);
5961
+ }
5954
5962
  }
5955
5963
  if (!initErrors.length && !("HALF_FLOAT" in glContext)) {
5956
5964
  // @ts-expect-error set default value
@@ -13503,6 +13511,7 @@ var EventSystem = /*#__PURE__*/ function() {
13503
13511
  var touchstart = "mousedown";
13504
13512
  var touchmove = "mousemove";
13505
13513
  var touchend = "mouseup";
13514
+ var touchcancel = "mouseleave";
13506
13515
  var getTouchEventValue = function(event, x, y, dx, dy) {
13507
13516
  if (dx === void 0) dx = 0;
13508
13517
  if (dy === void 0) dy = 0;
@@ -13556,6 +13565,7 @@ var EventSystem = /*#__PURE__*/ function() {
13556
13565
  touchstart = "touchstart";
13557
13566
  touchmove = "touchmove";
13558
13567
  touchend = "touchend";
13568
+ touchcancel = "touchcancel";
13559
13569
  }
13560
13570
  var _obj;
13561
13571
  this.nativeHandlers = (_obj = {}, _obj[touchstart] = function(event) {
@@ -13598,6 +13608,7 @@ var EventSystem = /*#__PURE__*/ function() {
13598
13608
  }
13599
13609
  currentTouch = 0;
13600
13610
  }, _obj);
13611
+ this.nativeHandlers[touchcancel] = this.nativeHandlers[touchend];
13601
13612
  Object.keys(this.nativeHandlers).forEach(function(name) {
13602
13613
  var _this_target;
13603
13614
  (_this_target = _this.target) == null ? void 0 : _this_target.addEventListener(String(name), _this.nativeHandlers[name]);
@@ -26404,10 +26415,14 @@ var TextComponentBase = /*#__PURE__*/ function() {
26404
26415
  _proto.getLineCount = function getLineCount(text, init) {
26405
26416
  var context = this.context;
26406
26417
  var _this_textLayout = this.textLayout, letterSpace = _this_textLayout.letterSpace, overflow = _this_textLayout.overflow;
26407
- var fontScale = init ? this.textStyle.fontSize / 10 * this.textStyle.fontScale : this.textStyle.fontScale;
26408
- var width = (this.textLayout.width + this.textStyle.fontOffset) * this.textStyle.fontScale;
26418
+ var fontScale = init ? this.textStyle.fontSize / 10 : 1 / this.textStyle.fontScale;
26419
+ var width = this.textLayout.width + this.textStyle.fontOffset;
26409
26420
  var lineCount = 1;
26410
26421
  var x = 0;
26422
+ //设置context.font的字号
26423
+ // if (context) {
26424
+ // context.font = this.getFontDesc(this.textStyle.fontSize);
26425
+ // }
26411
26426
  for(var i = 0; i < text.length; i++){
26412
26427
  var _context_measureText;
26413
26428
  var str = text[i];
@@ -28596,7 +28611,7 @@ function getStandardSpriteContent(sprite, transform) {
28596
28611
  return ret;
28597
28612
  }
28598
28613
 
28599
- var version$2 = "2.5.4";
28614
+ var version$2 = "2.5.6";
28600
28615
  var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
28601
28616
  var standardVersion = /^(\d+)\.(\d+)$/;
28602
28617
  var reverseParticle = false;
@@ -31846,7 +31861,7 @@ registerPlugin("sprite", SpriteLoader, exports.VFXItem);
31846
31861
  registerPlugin("particle", ParticleLoader, exports.VFXItem);
31847
31862
  registerPlugin("cal", CalculateLoader, exports.VFXItem);
31848
31863
  registerPlugin("interact", InteractLoader, exports.VFXItem);
31849
- var version$1 = "2.5.4";
31864
+ var version$1 = "2.5.6";
31850
31865
  logger.info("Core version: " + version$1 + ".");
31851
31866
 
31852
31867
  var _obj;
@@ -33448,7 +33463,7 @@ setMaxSpriteMeshItemCount(8);
33448
33463
  */ Mesh.create = function(engine, props) {
33449
33464
  return new ThreeMesh(engine, props);
33450
33465
  };
33451
- var version = "2.5.4";
33466
+ var version = "2.5.6";
33452
33467
  logger.info("THREEJS plugin version: " + version + ".");
33453
33468
 
33454
33469
  exports.AbstractPlugin = AbstractPlugin;
@@ -33585,6 +33600,7 @@ exports.base64ToFile = base64ToFile;
33585
33600
  exports.blend = blend;
33586
33601
  exports.buildLine = buildLine;
33587
33602
  exports.calculateTranslation = calculateTranslation;
33603
+ exports.canUseBOM = canUseBOM;
33588
33604
  exports.canvasPool = canvasPool;
33589
33605
  exports.closePointEps = closePointEps;
33590
33606
  exports.colorGradingFrag = colorGradingFrag;