@galacean/effects-threejs 2.8.5 → 2.8.7

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.5
6
+ * Version: v2.8.7
7
7
  */
8
8
 
9
9
  'use strict';
@@ -2466,11 +2466,8 @@ function parsePercent$1(c) {
2466
2466
  }
2467
2467
 
2468
2468
  function getPixelRatio() {
2469
- if (typeof screen === "object" && typeof document === "object") {
2470
- var viewportWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
2471
- var screenWidth = screen.width;
2472
- var viewportScale = screenWidth / viewportWidth;
2473
- return Math.min(2 * viewportScale, 2);
2469
+ if (typeof window === "object") {
2470
+ return Math.min(2, window.devicePixelRatio || 1);
2474
2471
  }
2475
2472
  return 1;
2476
2473
  }
@@ -17216,22 +17213,6 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
17216
17213
  this.transform.scaleBy(x, y, z);
17217
17214
  };
17218
17215
  /**
17219
- * 设置元素在画布上的像素位置
17220
- * Tips:
17221
- * - 坐标原点在 canvas 左上角,x 正方向水平向右, y 正方向垂直向下
17222
- * - 设置后会覆盖原有的位置信息
17223
- * @param x - x 坐标
17224
- * @param y - y 坐标
17225
- */ _proto.setPositionByPixel = function setPositionByPixel(x, y) {
17226
- if (this.composition) {
17227
- var z = this.transform.getWorldPosition().z;
17228
- var _this_composition_camera_getInverseVPRatio = this.composition.camera.getInverseVPRatio(z), rx = _this_composition_camera_getInverseVPRatio.x, ry = _this_composition_camera_getInverseVPRatio.y;
17229
- var width = this.composition.renderer.getWidth() / 2;
17230
- var height = this.composition.renderer.getHeight() / 2;
17231
- this.transform.setPosition((2 * x / width - 1) * rx, (1 - 2 * y / height) * ry, z);
17232
- }
17233
- };
17234
- /**
17235
17216
  * 设置本地坐标位置
17236
17217
  */ _proto.setPosition = function setPosition(x, y, z) {
17237
17218
  this.transform.setPosition(x, y, z);
@@ -17255,6 +17236,29 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
17255
17236
  this.transform.setWorldPosition(x, y, z);
17256
17237
  };
17257
17238
  /**
17239
+ * 设置元素在画布上的像素位置
17240
+ * Tips:
17241
+ * - 坐标原点在 canvas 左上角,x 正方向水平向右, y 正方向垂直向下
17242
+ * - 设置后会覆盖原有的位置信息
17243
+ * @param x - x 坐标
17244
+ * @param y - y 坐标
17245
+ */ _proto.setPositionByPixel = function setPositionByPixel(x, y) {
17246
+ if (this.composition) {
17247
+ var z = this.transform.getWorldPosition().z;
17248
+ var _this_composition_camera_getInverseVPRatio = this.composition.camera.getInverseVPRatio(z), rx = _this_composition_camera_getInverseVPRatio.x, ry = _this_composition_camera_getInverseVPRatio.y;
17249
+ var _this_composition_getEngine_canvas_getBoundingClientRect = this.composition.getEngine().canvas.getBoundingClientRect(), width = _this_composition_getEngine_canvas_getBoundingClientRect.width, height = _this_composition_getEngine_canvas_getBoundingClientRect.height;
17250
+ this.transform.setPosition((2 * x / width - 1) * rx, (1 - 2 * y / height) * ry, z);
17251
+ }
17252
+ };
17253
+ _proto.translateByPixel = function translateByPixel(x, y) {
17254
+ if (this.composition) {
17255
+ var _this_composition_getEngine_canvas_getBoundingClientRect = this.composition.getEngine().canvas.getBoundingClientRect(), width = _this_composition_getEngine_canvas_getBoundingClientRect.width, height = _this_composition_getEngine_canvas_getBoundingClientRect.height;
17256
+ var z = this.transform.getWorldPosition().z;
17257
+ var _this_composition_camera_getInverseVPRatio = this.composition.camera.getInverseVPRatio(z), rx = _this_composition_camera_getInverseVPRatio.x, ry = _this_composition_camera_getInverseVPRatio.y;
17258
+ this.transform.translate(2 * x * rx / width, -2 * y * ry / height, 0);
17259
+ }
17260
+ };
17261
+ /**
17258
17262
  * 获取元素包围盒
17259
17263
  * @override
17260
17264
  */ _proto.getBoundingBox = function getBoundingBox() {
@@ -17442,14 +17446,6 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
17442
17446
  }
17443
17447
  this.defination.content = {};
17444
17448
  };
17445
- _proto.translateByPixel = function translateByPixel(x, y) {
17446
- if (this.composition) {
17447
- var _this_composition_getEngine_canvas_getBoundingClientRect = this.composition.getEngine().canvas.getBoundingClientRect(), width = _this_composition_getEngine_canvas_getBoundingClientRect.width, height = _this_composition_getEngine_canvas_getBoundingClientRect.height;
17448
- var z = this.transform.getWorldPosition().z;
17449
- var _this_composition_camera_getInverseVPRatio = this.composition.camera.getInverseVPRatio(z), rx = _this_composition_camera_getInverseVPRatio.x, ry = _this_composition_camera_getInverseVPRatio.y;
17450
- this.transform.translate(2 * x * rx / width, -2 * y * ry / height, 0);
17451
- }
17452
- };
17453
17449
  /**
17454
17450
  * 销毁元素
17455
17451
  */ _proto.dispose = function dispose() {
@@ -28890,7 +28886,6 @@ var TextComponentBase = /*#__PURE__*/ function() {
28890
28886
  this.lineCount = 0;
28891
28887
  this.maxLineWidth = 0;
28892
28888
  // 常量
28893
- this.SCALE_FACTOR = 0.1;
28894
28889
  this.ALPHA_FIX_VALUE = 1 / 255;
28895
28890
  }
28896
28891
  var _proto = TextComponentBase.prototype;
@@ -31647,7 +31642,7 @@ function getStandardSpriteContent(sprite, transform) {
31647
31642
  return ret;
31648
31643
  }
31649
31644
 
31650
- var version$2 = "2.8.5";
31645
+ var version$2 = "2.8.7";
31651
31646
  var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
31652
31647
  var standardVersion = /^(\d+)\.(\d+)$/;
31653
31648
  var reverseParticle = false;
@@ -34707,8 +34702,8 @@ var DEFAULT_FPS = 60;
34707
34702
  });
34708
34703
  this.resetTickers = false;
34709
34704
  }
34710
- for(var i = 0, len = this.tickers.length; i < len; i++){
34711
- var tick = this.tickers[i];
34705
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.tickers), _step; !(_step = _iterator()).done;){
34706
+ var tick = _step.value;
34712
34707
  tick(this.dt);
34713
34708
  }
34714
34709
  }
@@ -35347,7 +35342,7 @@ registerPlugin("text", TextLoader);
35347
35342
  registerPlugin("sprite", SpriteLoader);
35348
35343
  registerPlugin("particle", ParticleLoader);
35349
35344
  registerPlugin("interact", InteractLoader);
35350
- var version$1 = "2.8.5";
35345
+ var version$1 = "2.8.7";
35351
35346
  logger.info("Core version: " + version$1 + ".");
35352
35347
 
35353
35348
  var _obj;
@@ -36924,7 +36919,7 @@ applyMixins(exports.ThreeTextComponent, [
36924
36919
  */ Mesh.create = function(engine, props) {
36925
36920
  return new ThreeMesh(engine, props);
36926
36921
  };
36927
- var version = "2.8.5";
36922
+ var version = "2.8.7";
36928
36923
  logger.info("THREEJS plugin version: " + version + ".");
36929
36924
 
36930
36925
  exports.ActivationMixerPlayable = ActivationMixerPlayable;