@galacean/effects-threejs 2.3.0-beta.2 → 2.3.0-beta.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 +20 -19
- 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 +20 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
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.3.0-beta.
|
|
6
|
+
* Version: v2.3.0-beta.3
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as THREE from 'three';
|
|
@@ -25519,9 +25519,12 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
25519
25519
|
this.textStyle = new TextStyle(options);
|
|
25520
25520
|
this.textLayout = new TextLayout(options);
|
|
25521
25521
|
this.text = options.text.toString();
|
|
25522
|
+
this.lineCount = this.getLineCount(options.text, true);
|
|
25522
25523
|
};
|
|
25523
|
-
_proto.getLineCount = function getLineCount(text,
|
|
25524
|
+
_proto.getLineCount = function getLineCount(text, init) {
|
|
25525
|
+
var context = this.context;
|
|
25524
25526
|
var _this_textLayout = this.textLayout, letterSpace = _this_textLayout.letterSpace, overflow = _this_textLayout.overflow;
|
|
25527
|
+
var fontScale = init ? this.textStyle.fontSize / 10 : 1 / this.textStyle.fontScale;
|
|
25525
25528
|
var width = this.textLayout.width + this.textStyle.fontOffset;
|
|
25526
25529
|
var lineCount = 1;
|
|
25527
25530
|
var x = 0;
|
|
@@ -25529,7 +25532,7 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
25529
25532
|
var _context_measureText;
|
|
25530
25533
|
var str = text[i];
|
|
25531
25534
|
var _context_measureText_width;
|
|
25532
|
-
var textMetrics = (_context_measureText_width = context == null ? void 0 : (_context_measureText = context.measureText(str)) == null ? void 0 : _context_measureText.width) != null ? _context_measureText_width : 0;
|
|
25535
|
+
var textMetrics = ((_context_measureText_width = context == null ? void 0 : (_context_measureText = context.measureText(str)) == null ? void 0 : _context_measureText.width) != null ? _context_measureText_width : 0) * fontScale;
|
|
25533
25536
|
// 和浏览器行为保持一致
|
|
25534
25537
|
x += letterSpace;
|
|
25535
25538
|
// 处理文本结束行为
|
|
@@ -25599,6 +25602,7 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
25599
25602
|
return;
|
|
25600
25603
|
}
|
|
25601
25604
|
this.text = value.toString();
|
|
25605
|
+
this.lineCount = this.getLineCount(value, false);
|
|
25602
25606
|
this.isDirty = true;
|
|
25603
25607
|
};
|
|
25604
25608
|
/**
|
|
@@ -25759,35 +25763,32 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
25759
25763
|
var layout = this.textLayout;
|
|
25760
25764
|
var fontScale = style.fontScale;
|
|
25761
25765
|
var width = (layout.width + style.fontOffset) * fontScale;
|
|
25766
|
+
var finalHeight = layout.lineHeight * this.lineCount;
|
|
25762
25767
|
var fontSize = style.fontSize * fontScale;
|
|
25763
25768
|
var lineHeight = layout.lineHeight * fontScale;
|
|
25764
25769
|
style.fontDesc = this.getFontDesc(fontSize);
|
|
25765
25770
|
this.char = (this.text || "").split("");
|
|
25766
25771
|
this.canvas.width = width;
|
|
25767
|
-
var height = this.canvas.height;
|
|
25768
|
-
context.font = style.fontDesc;
|
|
25769
|
-
this.lineCount = this.getLineCount(this.text, context);
|
|
25770
|
-
var finalHeight = layout.lineHeight * this.lineCount;
|
|
25771
25772
|
if (layout.autoWidth) {
|
|
25772
25773
|
this.canvas.height = finalHeight * fontScale;
|
|
25773
25774
|
this.item.transform.size.set(1, finalHeight / layout.height);
|
|
25774
25775
|
} else {
|
|
25775
25776
|
this.canvas.height = layout.height * fontScale;
|
|
25776
25777
|
}
|
|
25778
|
+
var height = this.canvas.height;
|
|
25779
|
+
// fix bug 1/255
|
|
25780
|
+
context.fillStyle = "rgba(255, 255, 255, 0.0039)";
|
|
25781
|
+
if (!flipY) {
|
|
25782
|
+
context.translate(0, height);
|
|
25783
|
+
context.scale(1, -1);
|
|
25784
|
+
}
|
|
25777
25785
|
// canvas size 变化后重新刷新 context
|
|
25778
25786
|
if (this.maxLineWidth > width && layout.overflow === TextOverflow.display) {
|
|
25779
25787
|
context.font = this.getFontDesc(fontSize * width / this.maxLineWidth);
|
|
25780
25788
|
} else {
|
|
25781
25789
|
context.font = style.fontDesc;
|
|
25782
25790
|
}
|
|
25783
|
-
// fix bug 1/255
|
|
25784
|
-
context.fillStyle = "rgba(255, 255, 255, 0.0039)";
|
|
25785
25791
|
context.clearRect(0, 0, width, height);
|
|
25786
|
-
if (!flipY) {
|
|
25787
|
-
context.translate(0, height);
|
|
25788
|
-
context.scale(1, -1);
|
|
25789
|
-
}
|
|
25790
|
-
context.fillRect(0, 0, width, height);
|
|
25791
25792
|
if (style.hasShadow) {
|
|
25792
25793
|
this.setupShadow();
|
|
25793
25794
|
}
|
|
@@ -25859,9 +25860,9 @@ var TextComponentBase = /*#__PURE__*/ function() {
|
|
|
25859
25860
|
this.material.setTexture("_MainTex", texture);
|
|
25860
25861
|
this.isDirty = false;
|
|
25861
25862
|
};
|
|
25862
|
-
_proto.getFontDesc = function getFontDesc(
|
|
25863
|
-
var _this_textStyle = this.textStyle, fontFamily = _this_textStyle.fontFamily, textWeight = _this_textStyle.textWeight, fontStyle = _this_textStyle.fontStyle;
|
|
25864
|
-
var fontDesc = "" + fontSize.toString() + "px ";
|
|
25863
|
+
_proto.getFontDesc = function getFontDesc(size) {
|
|
25864
|
+
var _this_textStyle = this.textStyle, fontSize = _this_textStyle.fontSize, fontScale = _this_textStyle.fontScale, fontFamily = _this_textStyle.fontFamily, textWeight = _this_textStyle.textWeight, fontStyle = _this_textStyle.fontStyle;
|
|
25865
|
+
var fontDesc = "" + (size || fontSize * fontScale).toString() + "px ";
|
|
25865
25866
|
if (!DEFAULT_FONTS.includes(fontFamily)) {
|
|
25866
25867
|
fontDesc += '"' + fontFamily + '"';
|
|
25867
25868
|
} else {
|
|
@@ -32076,7 +32077,7 @@ registerPlugin("sprite", SpriteLoader, VFXItem);
|
|
|
32076
32077
|
registerPlugin("particle", ParticleLoader, VFXItem);
|
|
32077
32078
|
registerPlugin("cal", CalculateLoader, VFXItem);
|
|
32078
32079
|
registerPlugin("interact", InteractLoader, VFXItem);
|
|
32079
|
-
var version$1 = "2.3.0-beta.
|
|
32080
|
+
var version$1 = "2.3.0-beta.3";
|
|
32080
32081
|
logger.info("Core version: " + version$1 + ".");
|
|
32081
32082
|
|
|
32082
32083
|
var _obj;
|
|
@@ -33722,7 +33723,7 @@ setMaxSpriteMeshItemCount(8);
|
|
|
33722
33723
|
*/ Mesh.create = function(engine, props) {
|
|
33723
33724
|
return new ThreeMesh(engine, props);
|
|
33724
33725
|
};
|
|
33725
|
-
var version = "2.3.0-beta.
|
|
33726
|
+
var version = "2.3.0-beta.3";
|
|
33726
33727
|
logger.info("THREEJS plugin version: " + version + ".");
|
|
33727
33728
|
|
|
33728
33729
|
export { AbstractPlugin, ActivationPlayable, ActivationPlayableAsset, ActivationTrack, AnimationClip, AnimationClipPlayable, Asset, AssetLoader, AssetManager, AssetService, BYTES_TYPE_MAP, BaseRenderComponent, Behaviour, BezierCurve, BezierCurvePath, BezierCurveQuat, BinaryAsset, COMPRESSED_TEXTURE, CONSTANT_MAP_BLEND, CONSTANT_MAP_DEPTH, CONSTANT_MAP_STENCIL_FUNC, CONSTANT_MAP_STENCIL_OP, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, ColorCurve, ColorPropertyPlayableAsset, ColorPropertyTrack, Component, Composition, CompositionComponent, CompositionSourceManager, DEFAULT_FONTS, DEFAULT_FPS, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, EffectsPackage, Engine, EventEmitter, EventSystem, Fake3DAnimationMode, Fake3DComponent, FilterMode, Float16ArrayWrapper, FloatPropertyPlayableAsset, FloatPropertyTrack, Framebuffer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK, HitTestType, InteractComponent, InteractLoader, InteractMesh, Item, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, MaterialTrack, Mesh, MeshCollider, ObjectBindingTrack, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleBehaviourPlayableAsset, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, ParticleTrack, PassTextureCache, PathSegments, PluginSystem, PostProcessVolume, PropertyTrack, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderbuffer, Renderer, RendererComponent, RuntimeClip, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, Scene, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderFactory, ShaderType, ShaderVariant, ShapeComponent, SpriteColorPlayableAsset, SpriteColorTrack, SpriteComponent, SpriteLoader, StaticValue, SubCompositionPlayableAsset, SubCompositionTrack, TEMPLATE_USE_OFFSCREEN_CANVAS, TEXTURE_UNIFORM_MAP, TextComponent, TextComponentBase, TextLayout, TextLoader, TextStyle, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, ThreeComposition, ThreeDisplayObject, ThreeEngine, ThreeMaterial, ThreeSpriteComponent, ThreeTextComponent, ThreeTexture, Ticker, TimelineAsset, TimelineClip, TimelinePlayable, TrackAsset, TrackSortWrapper, TrackType, Transform, TransformAnimationPlayable, TransformPlayableAsset, TransformTrack, VFXItem, ValueGetter, Vector2Curve, Vector2PropertyPlayableAsset, Vector2PropertyTrack, Vector4Curve, Vector4PropertyPlayableAsset, Vector4PropertyTrack, addByOrder, addItem, addItemWithOrder, applyMixins, assertExist, asserts, base64ToFile, blend, calculateTranslation, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, createCopyShader, createGLContext, createKeyFrameMeta, createShape, createValueGetter, decimalEqual, defaultPlugins, deserializeMipmapTexture, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureFixedNumber, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, generateTransparentTexture, generateWhiteTexture, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, glType2VertexFormatType, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvas, isFunction, isIOS, isIOSByUA, isMiniProgram, isObject, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, isWechatMiniApp, itemFrag, itemFrameFrag, itemVert, loadAVIFOptional, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, normalizeColor, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap$1 as particleOriginTranslateMap, particleUniformTypeMap, particleVert, passRenderLevel, pluginLoaderMap, randomInRange, registerPlugin, removeItem, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxItemCountByGPU, setUniformValue, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecFill, vecMulCombine, version, vertexFormatType2GLType };
|