@galacean/effects-core 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 core 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';
@@ -2444,11 +2444,8 @@ function parsePercent$1(c) {
2444
2444
  }
2445
2445
 
2446
2446
  function getPixelRatio() {
2447
- if (typeof screen === "object" && typeof document === "object") {
2448
- var viewportWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
2449
- var screenWidth = screen.width;
2450
- var viewportScale = screenWidth / viewportWidth;
2451
- return Math.min(2 * viewportScale, 2);
2447
+ if (typeof window === "object") {
2448
+ return Math.min(2, window.devicePixelRatio || 1);
2452
2449
  }
2453
2450
  return 1;
2454
2451
  }
@@ -17194,22 +17191,6 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
17194
17191
  this.transform.scaleBy(x, y, z);
17195
17192
  };
17196
17193
  /**
17197
- * 设置元素在画布上的像素位置
17198
- * Tips:
17199
- * - 坐标原点在 canvas 左上角,x 正方向水平向右, y 正方向垂直向下
17200
- * - 设置后会覆盖原有的位置信息
17201
- * @param x - x 坐标
17202
- * @param y - y 坐标
17203
- */ _proto.setPositionByPixel = function setPositionByPixel(x, y) {
17204
- if (this.composition) {
17205
- var z = this.transform.getWorldPosition().z;
17206
- var _this_composition_camera_getInverseVPRatio = this.composition.camera.getInverseVPRatio(z), rx = _this_composition_camera_getInverseVPRatio.x, ry = _this_composition_camera_getInverseVPRatio.y;
17207
- var width = this.composition.renderer.getWidth() / 2;
17208
- var height = this.composition.renderer.getHeight() / 2;
17209
- this.transform.setPosition((2 * x / width - 1) * rx, (1 - 2 * y / height) * ry, z);
17210
- }
17211
- };
17212
- /**
17213
17194
  * 设置本地坐标位置
17214
17195
  */ _proto.setPosition = function setPosition(x, y, z) {
17215
17196
  this.transform.setPosition(x, y, z);
@@ -17233,6 +17214,29 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
17233
17214
  this.transform.setWorldPosition(x, y, z);
17234
17215
  };
17235
17216
  /**
17217
+ * 设置元素在画布上的像素位置
17218
+ * Tips:
17219
+ * - 坐标原点在 canvas 左上角,x 正方向水平向右, y 正方向垂直向下
17220
+ * - 设置后会覆盖原有的位置信息
17221
+ * @param x - x 坐标
17222
+ * @param y - y 坐标
17223
+ */ _proto.setPositionByPixel = function setPositionByPixel(x, y) {
17224
+ if (this.composition) {
17225
+ var z = this.transform.getWorldPosition().z;
17226
+ var _this_composition_camera_getInverseVPRatio = this.composition.camera.getInverseVPRatio(z), rx = _this_composition_camera_getInverseVPRatio.x, ry = _this_composition_camera_getInverseVPRatio.y;
17227
+ 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;
17228
+ this.transform.setPosition((2 * x / width - 1) * rx, (1 - 2 * y / height) * ry, z);
17229
+ }
17230
+ };
17231
+ _proto.translateByPixel = function translateByPixel(x, y) {
17232
+ if (this.composition) {
17233
+ 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;
17234
+ var z = this.transform.getWorldPosition().z;
17235
+ var _this_composition_camera_getInverseVPRatio = this.composition.camera.getInverseVPRatio(z), rx = _this_composition_camera_getInverseVPRatio.x, ry = _this_composition_camera_getInverseVPRatio.y;
17236
+ this.transform.translate(2 * x * rx / width, -2 * y * ry / height, 0);
17237
+ }
17238
+ };
17239
+ /**
17236
17240
  * 获取元素包围盒
17237
17241
  * @override
17238
17242
  */ _proto.getBoundingBox = function getBoundingBox() {
@@ -17420,14 +17424,6 @@ exports.VFXItem = /*#__PURE__*/ function(EffectsObject) {
17420
17424
  }
17421
17425
  this.defination.content = {};
17422
17426
  };
17423
- _proto.translateByPixel = function translateByPixel(x, y) {
17424
- if (this.composition) {
17425
- 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;
17426
- var z = this.transform.getWorldPosition().z;
17427
- var _this_composition_camera_getInverseVPRatio = this.composition.camera.getInverseVPRatio(z), rx = _this_composition_camera_getInverseVPRatio.x, ry = _this_composition_camera_getInverseVPRatio.y;
17428
- this.transform.translate(2 * x * rx / width, -2 * y * ry / height, 0);
17429
- }
17430
- };
17431
17427
  /**
17432
17428
  * 销毁元素
17433
17429
  */ _proto.dispose = function dispose() {
@@ -28868,7 +28864,6 @@ var TextComponentBase = /*#__PURE__*/ function() {
28868
28864
  this.lineCount = 0;
28869
28865
  this.maxLineWidth = 0;
28870
28866
  // 常量
28871
- this.SCALE_FACTOR = 0.1;
28872
28867
  this.ALPHA_FIX_VALUE = 1 / 255;
28873
28868
  }
28874
28869
  var _proto = TextComponentBase.prototype;
@@ -31625,7 +31620,7 @@ function getStandardSpriteContent(sprite, transform) {
31625
31620
  return ret;
31626
31621
  }
31627
31622
 
31628
- var version$1 = "2.8.5";
31623
+ var version$1 = "2.8.7";
31629
31624
  var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
31630
31625
  var standardVersion = /^(\d+)\.(\d+)$/;
31631
31626
  var reverseParticle = false;
@@ -34685,8 +34680,8 @@ var DEFAULT_FPS = 60;
34685
34680
  });
34686
34681
  this.resetTickers = false;
34687
34682
  }
34688
- for(var i = 0, len = this.tickers.length; i < len; i++){
34689
- var tick = this.tickers[i];
34683
+ for(var _iterator = _create_for_of_iterator_helper_loose(this.tickers), _step; !(_step = _iterator()).done;){
34684
+ var tick = _step.value;
34690
34685
  tick(this.dt);
34691
34686
  }
34692
34687
  }
@@ -35325,7 +35320,7 @@ registerPlugin("text", TextLoader);
35325
35320
  registerPlugin("sprite", SpriteLoader);
35326
35321
  registerPlugin("particle", ParticleLoader);
35327
35322
  registerPlugin("interact", InteractLoader);
35328
- var version = "2.8.5";
35323
+ var version = "2.8.7";
35329
35324
  logger.info("Core version: " + version + ".");
35330
35325
 
35331
35326
  exports.ActivationMixerPlayable = ActivationMixerPlayable;