@galacean/effects-threejs 2.8.1 → 2.8.3
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 +182 -68
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +182 -68
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
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.
|
|
6
|
+
* Version: v2.8.3
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -13372,22 +13372,34 @@ function _loadVideo() {
|
|
|
13372
13372
|
return [
|
|
13373
13373
|
2,
|
|
13374
13374
|
new Promise(function(resolve, reject) {
|
|
13375
|
-
var
|
|
13375
|
+
var settled = false;
|
|
13376
|
+
var handleSuccess = function() {
|
|
13377
|
+
if (settled) {
|
|
13378
|
+
return;
|
|
13379
|
+
}
|
|
13380
|
+
settled = true;
|
|
13381
|
+
cleanup();
|
|
13376
13382
|
resolve(video);
|
|
13377
|
-
video.removeEventListener("error", handleError);
|
|
13378
13383
|
};
|
|
13379
|
-
var handleError = function(
|
|
13380
|
-
|
|
13384
|
+
var handleError = function() {
|
|
13385
|
+
if (settled) {
|
|
13386
|
+
return;
|
|
13387
|
+
}
|
|
13388
|
+
settled = true;
|
|
13389
|
+
cleanup();
|
|
13381
13390
|
reject("Load video fail.");
|
|
13382
13391
|
};
|
|
13383
|
-
|
|
13384
|
-
|
|
13385
|
-
|
|
13386
|
-
|
|
13387
|
-
|
|
13392
|
+
var cleanup = function() {
|
|
13393
|
+
video.removeEventListener("loadeddata", handleSuccess);
|
|
13394
|
+
video.removeEventListener("canplay", handleSuccess);
|
|
13395
|
+
video.removeEventListener("error", handleError);
|
|
13396
|
+
};
|
|
13397
|
+
video.addEventListener("loadeddata", handleSuccess);
|
|
13398
|
+
video.addEventListener("canplay", handleSuccess);
|
|
13399
|
+
video.addEventListener("error", handleError);
|
|
13400
|
+
video.play().catch(function(err) {
|
|
13401
|
+
console.warn("Autoplay blocked:", err);
|
|
13388
13402
|
});
|
|
13389
|
-
// 显式触发视频加载
|
|
13390
|
-
video.load();
|
|
13391
13403
|
})
|
|
13392
13404
|
];
|
|
13393
13405
|
});
|
|
@@ -16689,10 +16701,7 @@ var LateUpdateTickData = /*#__PURE__*/ function(TickData) {
|
|
|
16689
16701
|
}
|
|
16690
16702
|
var regions = [];
|
|
16691
16703
|
var ray = this.getHitTestRay(x, y);
|
|
16692
|
-
this.
|
|
16693
|
-
var _ref_getComponent;
|
|
16694
|
-
(_ref_getComponent = ref.getComponent(exports.CompositionComponent)) == null ? void 0 : _ref_getComponent.hitTest(ray, x, y, regions, force, options);
|
|
16695
|
-
});
|
|
16704
|
+
this.rootComposition.hitTest(ray, x, y, regions, force, options);
|
|
16696
16705
|
return regions;
|
|
16697
16706
|
};
|
|
16698
16707
|
/**
|
|
@@ -17769,10 +17778,32 @@ exports.CompositionComponent = /*#__PURE__*/ function(Component) {
|
|
|
17769
17778
|
});
|
|
17770
17779
|
};
|
|
17771
17780
|
_proto.hitTest = function hitTest(ray, x, y, regions, force, options) {
|
|
17772
|
-
var
|
|
17773
|
-
|
|
17774
|
-
|
|
17775
|
-
|
|
17781
|
+
var _this_item_composition;
|
|
17782
|
+
var isHitTestSuccess = this.hitTestRecursive(this.item, ray, x, y, regions, force, options);
|
|
17783
|
+
// 子元素碰撞测试成功加入当前预合成元素,判断是否是合成根元素,根元素不加入
|
|
17784
|
+
if (isHitTestSuccess && this.item !== ((_this_item_composition = this.item.composition) == null ? void 0 : _this_item_composition.rootItem)) {
|
|
17785
|
+
var item = this.item;
|
|
17786
|
+
var lastRegion = regions[regions.length - 1];
|
|
17787
|
+
var hitPositions = lastRegion.hitPositions;
|
|
17788
|
+
var region = {
|
|
17789
|
+
id: item.getInstanceId(),
|
|
17790
|
+
name: item.name,
|
|
17791
|
+
position: hitPositions[hitPositions.length - 1],
|
|
17792
|
+
parentId: item.parentId,
|
|
17793
|
+
hitPositions: hitPositions,
|
|
17794
|
+
behavior: InteractBehavior.NONE,
|
|
17795
|
+
item: item,
|
|
17796
|
+
composition: item.composition
|
|
17797
|
+
};
|
|
17798
|
+
regions.push(region);
|
|
17799
|
+
}
|
|
17800
|
+
return isHitTestSuccess;
|
|
17801
|
+
};
|
|
17802
|
+
_proto.hitTestRecursive = function hitTestRecursive(item, ray, x, y, regions, force, options) {
|
|
17803
|
+
var _this, _loop = function() {
|
|
17804
|
+
var hitTestItem = _step.value;
|
|
17805
|
+
if (hitTestItem.isActive && hitTestItem.transform.getValid() && !skip(hitTestItem)) {
|
|
17806
|
+
var hitParams = hitTestItem.getHitTestParams(force);
|
|
17776
17807
|
if (hitParams) {
|
|
17777
17808
|
var success = false;
|
|
17778
17809
|
var intersectPoint = new Vector3();
|
|
@@ -17817,35 +17848,48 @@ exports.CompositionComponent = /*#__PURE__*/ function(Component) {
|
|
|
17817
17848
|
}
|
|
17818
17849
|
if (success) {
|
|
17819
17850
|
var region = {
|
|
17820
|
-
|
|
17821
|
-
|
|
17822
|
-
name: item.name,
|
|
17851
|
+
id: hitTestItem.getInstanceId(),
|
|
17852
|
+
name: hitTestItem.name,
|
|
17823
17853
|
position: hitPositions[hitPositions.length - 1],
|
|
17824
|
-
parentId:
|
|
17854
|
+
parentId: hitTestItem.parentId,
|
|
17825
17855
|
hitPositions: hitPositions,
|
|
17826
17856
|
behavior: hitParams.behavior,
|
|
17827
|
-
item:
|
|
17857
|
+
item: hitTestItem,
|
|
17828
17858
|
composition: _this.item.composition
|
|
17829
17859
|
};
|
|
17830
17860
|
regions.push(region);
|
|
17861
|
+
hitTestSuccess = true;
|
|
17831
17862
|
if (stop(region)) {
|
|
17832
17863
|
return {
|
|
17833
|
-
v:
|
|
17864
|
+
v: true
|
|
17834
17865
|
};
|
|
17835
17866
|
}
|
|
17836
17867
|
}
|
|
17837
17868
|
}
|
|
17869
|
+
if (exports.VFXItem.isComposition(hitTestItem)) {
|
|
17870
|
+
if (hitTestItem.getComponent(CompositionComponent).hitTest(ray, x, y, regions, force, options)) {
|
|
17871
|
+
hitTestSuccess = true;
|
|
17872
|
+
}
|
|
17873
|
+
} else {
|
|
17874
|
+
if (_this.hitTestRecursive(hitTestItem, ray, x, y, regions, force, options)) {
|
|
17875
|
+
hitTestSuccess = true;
|
|
17876
|
+
}
|
|
17877
|
+
}
|
|
17838
17878
|
}
|
|
17839
17879
|
};
|
|
17840
17880
|
var hitPositions = [];
|
|
17841
17881
|
var stop = (options == null ? void 0 : options.stop) || noop;
|
|
17842
17882
|
var skip = (options == null ? void 0 : options.skip) || noop;
|
|
17843
|
-
var maxCount =
|
|
17844
|
-
|
|
17845
|
-
|
|
17883
|
+
var maxCount = options == null ? void 0 : options.maxCount;
|
|
17884
|
+
if (maxCount !== undefined && regions.length >= maxCount) {
|
|
17885
|
+
return false;
|
|
17886
|
+
}
|
|
17887
|
+
var hitTestSuccess = false;
|
|
17888
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(item.children), _step; !(_step = _iterator()).done;){
|
|
17889
|
+
var _ret = (_this = this, _loop());
|
|
17846
17890
|
if (_type_of(_ret) === "object") return _ret.v;
|
|
17847
17891
|
}
|
|
17848
|
-
return
|
|
17892
|
+
return hitTestSuccess;
|
|
17849
17893
|
};
|
|
17850
17894
|
/**
|
|
17851
17895
|
* 设置当前合成子元素的渲染顺序
|
|
@@ -18348,6 +18392,15 @@ exports.PostProcessVolume = __decorate([
|
|
|
18348
18392
|
});
|
|
18349
18393
|
})();
|
|
18350
18394
|
};
|
|
18395
|
+
_proto.onUpdate = function onUpdate(dt) {
|
|
18396
|
+
for(var i = 0; i < this.materials.length; i++){
|
|
18397
|
+
var material = this.materials[i];
|
|
18398
|
+
material.setVector2("_Size", this.transform.size);
|
|
18399
|
+
if (this.renderer.renderMode === RenderMode.BILLBOARD || this.renderer.renderMode === RenderMode.VERTICAL_BILLBOARD || this.renderer.renderMode === RenderMode.HORIZONTAL_BILLBOARD) {
|
|
18400
|
+
material.setVector3("_Scale", this.transform.scale);
|
|
18401
|
+
}
|
|
18402
|
+
}
|
|
18403
|
+
};
|
|
18351
18404
|
_proto.render = function render(renderer) {
|
|
18352
18405
|
if (!this.getVisible()) {
|
|
18353
18406
|
return;
|
|
@@ -18409,12 +18462,7 @@ exports.PostProcessVolume = __decorate([
|
|
|
18409
18462
|
};
|
|
18410
18463
|
_proto.draw = function draw(renderer) {
|
|
18411
18464
|
for(var i = 0; i < this.materials.length; i++){
|
|
18412
|
-
|
|
18413
|
-
material.setVector2("_Size", this.transform.size);
|
|
18414
|
-
if (this.renderer.renderMode === RenderMode.BILLBOARD || this.renderer.renderMode === RenderMode.VERTICAL_BILLBOARD || this.renderer.renderMode === RenderMode.HORIZONTAL_BILLBOARD) {
|
|
18415
|
-
material.setVector3("_Scale", this.transform.scale);
|
|
18416
|
-
}
|
|
18417
|
-
renderer.drawGeometry(this.geometry, this.transform.getWorldMatrix(), material, i);
|
|
18465
|
+
renderer.drawGeometry(this.geometry, this.transform.getWorldMatrix(), this.materials[i], i);
|
|
18418
18466
|
}
|
|
18419
18467
|
};
|
|
18420
18468
|
_proto.fromData = function fromData(data) {
|
|
@@ -25672,6 +25720,7 @@ exports.SpriteComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
25672
25720
|
var _proto = SpriteComponent.prototype;
|
|
25673
25721
|
_proto.onUpdate = function onUpdate(dt) {
|
|
25674
25722
|
var _this = this;
|
|
25723
|
+
MaskableGraphic.prototype.onUpdate.call(this, dt);
|
|
25675
25724
|
var time = this.time;
|
|
25676
25725
|
var duration = this.duration;
|
|
25677
25726
|
var textureAnimation = this.textureSheetAnimation;
|
|
@@ -28665,11 +28714,11 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
28665
28714
|
* @param totalLineHeight - 可选的实际总行高,用于替代默认计算
|
|
28666
28715
|
* @returns - 行高偏移值
|
|
28667
28716
|
*/ _proto.getOffsetY = function getOffsetY(style, lineCount, lineHeight, fontSize, totalLineHeight) {
|
|
28668
|
-
var
|
|
28717
|
+
var fontScale = style.fontScale;
|
|
28669
28718
|
// /3 计算Y轴偏移量,以匹配编辑器行为
|
|
28670
28719
|
var offsetY = (lineHeight - fontSize) / 3;
|
|
28671
28720
|
// 计算基础偏移量
|
|
28672
|
-
var baseOffset = fontSize
|
|
28721
|
+
var baseOffset = fontSize;
|
|
28673
28722
|
var commonCalculation = totalLineHeight !== undefined ? totalLineHeight : lineHeight * (lineCount - 1);
|
|
28674
28723
|
var offsetResult = 0;
|
|
28675
28724
|
switch(this.textVerticalAlign){
|
|
@@ -28685,11 +28734,16 @@ var TextLayout = /*#__PURE__*/ function() {
|
|
|
28685
28734
|
}
|
|
28686
28735
|
return offsetResult;
|
|
28687
28736
|
};
|
|
28688
|
-
|
|
28737
|
+
/**
|
|
28738
|
+
* 获取初始的水平偏移值
|
|
28739
|
+
* @param style - 字体基础数据
|
|
28740
|
+
* @param maxWidth - 最大行宽
|
|
28741
|
+
* @returns - 水平偏移值
|
|
28742
|
+
*/ _proto.getOffsetX = function getOffsetX(style, maxWidth) {
|
|
28689
28743
|
var offsetX = 0;
|
|
28690
28744
|
switch(this.textAlign){
|
|
28691
28745
|
case TextAlignment.left:
|
|
28692
|
-
offsetX =
|
|
28746
|
+
offsetX = 0;
|
|
28693
28747
|
break;
|
|
28694
28748
|
case TextAlignment.middle:
|
|
28695
28749
|
offsetX = (this.width * style.fontScale - maxWidth) / 2;
|
|
@@ -28765,7 +28819,8 @@ var TextStyle = /*#__PURE__*/ function() {
|
|
|
28765
28819
|
1
|
|
28766
28820
|
];
|
|
28767
28821
|
this.outlineWidth = 0;
|
|
28768
|
-
|
|
28822
|
+
var _outline_outlineWidth;
|
|
28823
|
+
if (outline && ((_outline_outlineWidth = outline.outlineWidth) != null ? _outline_outlineWidth : 0) > 0) {
|
|
28769
28824
|
this.isOutlined = true;
|
|
28770
28825
|
var _outline_outlineColor;
|
|
28771
28826
|
this.outlineColor = [].concat((_outline_outlineColor = outline.outlineColor) != null ? _outline_outlineColor : [
|
|
@@ -28774,8 +28829,8 @@ var TextStyle = /*#__PURE__*/ function() {
|
|
|
28774
28829
|
1,
|
|
28775
28830
|
1
|
|
28776
28831
|
]);
|
|
28777
|
-
var
|
|
28778
|
-
this.outlineWidth = (
|
|
28832
|
+
var _outline_outlineWidth1;
|
|
28833
|
+
this.outlineWidth = (_outline_outlineWidth1 = outline.outlineWidth) != null ? _outline_outlineWidth1 : 0;
|
|
28779
28834
|
}
|
|
28780
28835
|
// 重置阴影状态
|
|
28781
28836
|
this.hasShadow = false;
|
|
@@ -29036,6 +29091,10 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29036
29091
|
* 文本行数
|
|
29037
29092
|
*/ _this.lineCount = 0;
|
|
29038
29093
|
/**
|
|
29094
|
+
* 描边/阴影等特效导致的纹理扩容比例 X/Y
|
|
29095
|
+
*/ _this.effectScaleX = 1;
|
|
29096
|
+
_this.effectScaleY = 1;
|
|
29097
|
+
/**
|
|
29039
29098
|
* 每一行文本的最大宽度
|
|
29040
29099
|
*/ _this.maxLineWidth = 0;
|
|
29041
29100
|
/**
|
|
@@ -29097,6 +29156,16 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29097
29156
|
_proto.onUpdate = function onUpdate(dt) {
|
|
29098
29157
|
MaskableGraphic.prototype.onUpdate.call(this, dt);
|
|
29099
29158
|
this.updateTexture();
|
|
29159
|
+
// 覆盖基类每帧更新 size 行为,应用扩容比例
|
|
29160
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(this.materials), _step; !(_step = _iterator()).done;){
|
|
29161
|
+
var material = _step.value;
|
|
29162
|
+
var sizeX = this.transform.size.x;
|
|
29163
|
+
var sizeY = this.transform.size.y;
|
|
29164
|
+
var _this_getTextureExpandScale = this.getTextureExpandScale(), scalex = _this_getTextureExpandScale[0], scaley = _this_getTextureExpandScale[1];
|
|
29165
|
+
sizeX *= scalex;
|
|
29166
|
+
sizeY *= scaley;
|
|
29167
|
+
material.setVector2("_Size", new Vector2(sizeX, sizeY));
|
|
29168
|
+
}
|
|
29100
29169
|
};
|
|
29101
29170
|
_proto.onDestroy = function onDestroy() {
|
|
29102
29171
|
MaskableGraphic.prototype.onDestroy.call(this);
|
|
@@ -29286,23 +29355,32 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29286
29355
|
var style = this.textStyle;
|
|
29287
29356
|
var layout = this.textLayout;
|
|
29288
29357
|
var fontScale = style.fontScale;
|
|
29289
|
-
var
|
|
29358
|
+
var baseWidth = (layout.width + style.fontOffset) * fontScale;
|
|
29290
29359
|
var finalHeight = layout.lineHeight * this.lineCount;
|
|
29291
29360
|
var fontSize = style.fontSize * fontScale;
|
|
29292
29361
|
var lineHeight = layout.lineHeight * fontScale;
|
|
29293
29362
|
style.fontDesc = this.getFontDesc(fontSize);
|
|
29294
29363
|
var char = (this.text || "").split("");
|
|
29364
|
+
var baseHeight = 0;
|
|
29295
29365
|
if (layout.autoWidth) {
|
|
29296
|
-
|
|
29366
|
+
baseHeight = finalHeight * fontScale;
|
|
29297
29367
|
this.item.transform.size.set(1, finalHeight / layout.height);
|
|
29298
29368
|
} else {
|
|
29299
|
-
|
|
29300
|
-
}
|
|
29301
|
-
var
|
|
29302
|
-
|
|
29369
|
+
baseHeight = layout.height * fontScale;
|
|
29370
|
+
}
|
|
29371
|
+
var _this_getEffectPadding = this.getEffectPadding(), padL = _this_getEffectPadding.padL, padR = _this_getEffectPadding.padR, padT = _this_getEffectPadding.padT, padB = _this_getEffectPadding.padB;
|
|
29372
|
+
var hasEffect = (padL | padR | padT | padB) !== 0;
|
|
29373
|
+
var texWidth = hasEffect ? Math.ceil(baseWidth + padL + padR) : baseWidth;
|
|
29374
|
+
var texHeight = hasEffect ? Math.ceil(baseHeight + padT + padB) : baseHeight;
|
|
29375
|
+
var shiftX = hasEffect ? padL : 0;
|
|
29376
|
+
var shiftY = hasEffect ? flipY ? padT : padB : 0;
|
|
29377
|
+
// 给渲染层用:扩容比例
|
|
29378
|
+
this.effectScaleX = baseWidth > 0 ? texWidth / baseWidth : 1;
|
|
29379
|
+
this.effectScaleY = baseHeight > 0 ? texHeight / baseHeight : 1;
|
|
29380
|
+
this.renderToTexture(texWidth, texHeight, flipY, function(context) {
|
|
29303
29381
|
// canvas size 变化后重新刷新 context
|
|
29304
|
-
if (_this.maxLineWidth >
|
|
29305
|
-
context.font = _this.getFontDesc(fontSize *
|
|
29382
|
+
if (_this.maxLineWidth > baseWidth && layout.overflow === TextOverflow.display) {
|
|
29383
|
+
context.font = _this.getFontDesc(fontSize * baseWidth / _this.maxLineWidth);
|
|
29306
29384
|
} else {
|
|
29307
29385
|
context.font = style.fontDesc;
|
|
29308
29386
|
}
|
|
@@ -29325,7 +29403,7 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29325
29403
|
var textMetrics = context.measureText(str);
|
|
29326
29404
|
// 和浏览器行为保持一致
|
|
29327
29405
|
x += layout.letterSpace * fontScale;
|
|
29328
|
-
if (x + textMetrics.width >
|
|
29406
|
+
if (x + textMetrics.width > baseWidth && i > 0 || str === "\n") {
|
|
29329
29407
|
charsInfo.push({
|
|
29330
29408
|
y: y,
|
|
29331
29409
|
width: x,
|
|
@@ -29349,14 +29427,27 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29349
29427
|
chars: charsArray,
|
|
29350
29428
|
charOffsetX: charOffsetX
|
|
29351
29429
|
});
|
|
29352
|
-
|
|
29353
|
-
|
|
29354
|
-
|
|
29355
|
-
|
|
29356
|
-
|
|
29430
|
+
// 先描边
|
|
29431
|
+
if (style.isOutlined) {
|
|
29432
|
+
charsInfo.forEach(function(charInfo) {
|
|
29433
|
+
var ox = layout.getOffsetX(style, charInfo.width);
|
|
29434
|
+
for(var i = 0; i < charInfo.chars.length; i++){
|
|
29435
|
+
var str = charInfo.chars[i];
|
|
29436
|
+
var drawX = shiftX + ox + charInfo.charOffsetX[i];
|
|
29437
|
+
var drawY = shiftY + charInfo.y;
|
|
29438
|
+
context.strokeText(str, drawX, drawY);
|
|
29357
29439
|
}
|
|
29358
|
-
context.fillText(str, x + charInfo.charOffsetX[i], charInfo.y);
|
|
29359
29440
|
});
|
|
29441
|
+
}
|
|
29442
|
+
// 再填充
|
|
29443
|
+
charsInfo.forEach(function(charInfo) {
|
|
29444
|
+
var ox = layout.getOffsetX(style, charInfo.width);
|
|
29445
|
+
for(var i = 0; i < charInfo.chars.length; i++){
|
|
29446
|
+
var str = charInfo.chars[i];
|
|
29447
|
+
var drawX = shiftX + ox + charInfo.charOffsetX[i];
|
|
29448
|
+
var drawY = shiftY + charInfo.y;
|
|
29449
|
+
context.fillText(str, drawX, drawY);
|
|
29450
|
+
}
|
|
29360
29451
|
});
|
|
29361
29452
|
if (style.hasShadow) {
|
|
29362
29453
|
context.shadowColor = "transparent";
|
|
@@ -29367,6 +29458,32 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29367
29458
|
_proto.renderText = function renderText(options) {
|
|
29368
29459
|
this.updateTexture();
|
|
29369
29460
|
};
|
|
29461
|
+
/**
|
|
29462
|
+
* 给渲染层用:获取特效扩容比例(描边/阴影导致的纹理扩容)
|
|
29463
|
+
* @returns
|
|
29464
|
+
*/ _proto.getTextureExpandScale = function getTextureExpandScale() {
|
|
29465
|
+
return [
|
|
29466
|
+
this.effectScaleX,
|
|
29467
|
+
this.effectScaleY
|
|
29468
|
+
];
|
|
29469
|
+
};
|
|
29470
|
+
/**
|
|
29471
|
+
* 获取描边和阴影的 padding 值(单位:px)
|
|
29472
|
+
* @returns
|
|
29473
|
+
*/ _proto.getEffectPadding = function getEffectPadding() {
|
|
29474
|
+
var style = this.textStyle;
|
|
29475
|
+
var hasDrawOutline = style.isOutlined && style.outlineWidth > 0;
|
|
29476
|
+
var outlinePad = hasDrawOutline ? Math.ceil(style.outlineWidth * 2 * style.fontScale) : 0;
|
|
29477
|
+
var hasShadow = style.hasShadow && (style.shadowBlur > 0 || style.shadowOffsetX !== 0 || style.shadowOffsetY !== 0);
|
|
29478
|
+
var shadowPad = hasShadow ? Math.ceil((Math.abs(style.shadowOffsetX) + Math.abs(style.shadowOffsetY) + style.shadowBlur) * style.fontScale) : 0;
|
|
29479
|
+
var pad = outlinePad + shadowPad;
|
|
29480
|
+
return {
|
|
29481
|
+
padL: pad,
|
|
29482
|
+
padR: pad,
|
|
29483
|
+
padT: pad,
|
|
29484
|
+
padB: pad
|
|
29485
|
+
};
|
|
29486
|
+
};
|
|
29370
29487
|
_proto.setAutoWidth = function setAutoWidth(value) {
|
|
29371
29488
|
var layout = this.textLayout;
|
|
29372
29489
|
var normalizedValue = !!value;
|
|
@@ -29417,14 +29534,11 @@ exports.TextComponent = /*#__PURE__*/ function(MaskableGraphic) {
|
|
|
29417
29534
|
this.isDirty = true;
|
|
29418
29535
|
};
|
|
29419
29536
|
_proto.setFontSize = function setFontSize(value) {
|
|
29420
|
-
|
|
29537
|
+
var size = Math.max(1, Number(value) || 1);
|
|
29538
|
+
if (this.textStyle.fontSize === size) {
|
|
29421
29539
|
return;
|
|
29422
29540
|
}
|
|
29423
|
-
|
|
29424
|
-
var diff = this.textStyle.fontSize - value;
|
|
29425
|
-
var layout = this.textLayout;
|
|
29426
|
-
layout.lineHeight += diff;
|
|
29427
|
-
this.textStyle.fontSize = value;
|
|
29541
|
+
this.textStyle.fontSize = size;
|
|
29428
29542
|
this.isDirty = true;
|
|
29429
29543
|
};
|
|
29430
29544
|
_proto.setOutlineWidth = function setOutlineWidth(value) {
|
|
@@ -31518,7 +31632,7 @@ function getStandardSpriteContent(sprite, transform) {
|
|
|
31518
31632
|
return ret;
|
|
31519
31633
|
}
|
|
31520
31634
|
|
|
31521
|
-
var version$2 = "2.8.
|
|
31635
|
+
var version$2 = "2.8.3";
|
|
31522
31636
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
31523
31637
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
31524
31638
|
var reverseParticle = false;
|
|
@@ -32863,7 +32977,7 @@ function _createTextureOptionsBySource() {
|
|
|
32863
32977
|
scene.jsonScene.items.forEach(function(item) {
|
|
32864
32978
|
if (item.type === ItemType.text || item.type === ItemType.richtext) {
|
|
32865
32979
|
var textVariable = variables[item.name];
|
|
32866
|
-
if (
|
|
32980
|
+
if (textVariable === undefined || textVariable === null) {
|
|
32867
32981
|
return;
|
|
32868
32982
|
}
|
|
32869
32983
|
item.components.forEach(function(param) {
|
|
@@ -35218,7 +35332,7 @@ registerPlugin("text", TextLoader);
|
|
|
35218
35332
|
registerPlugin("sprite", SpriteLoader);
|
|
35219
35333
|
registerPlugin("particle", ParticleLoader);
|
|
35220
35334
|
registerPlugin("interact", InteractLoader);
|
|
35221
|
-
var version$1 = "2.8.
|
|
35335
|
+
var version$1 = "2.8.3";
|
|
35222
35336
|
logger.info("Core version: " + version$1 + ".");
|
|
35223
35337
|
|
|
35224
35338
|
var _obj;
|
|
@@ -36795,7 +36909,7 @@ applyMixins(exports.ThreeTextComponent, [
|
|
|
36795
36909
|
*/ Mesh.create = function(engine, props) {
|
|
36796
36910
|
return new ThreeMesh(engine, props);
|
|
36797
36911
|
};
|
|
36798
|
-
var version = "2.8.
|
|
36912
|
+
var version = "2.8.3";
|
|
36799
36913
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
36800
36914
|
|
|
36801
36915
|
exports.ActivationMixerPlayable = ActivationMixerPlayable;
|