fl-web-component 1.2.9 → 1.2.11
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/README.md +4 -0
- package/dist/fl-web-component.common.js +134 -14
- package/dist/fl-web-component.common.js.map +1 -1
- package/package.json +1 -1
- package/src/utils/flgltf-parser.js +1 -0
- package/src/utils/instance-parser.js +132 -16
- package/src/assets/test.png +0 -0
- package/src/assets/worker.glb +0 -0
package/README.md
CHANGED
|
@@ -29241,7 +29241,7 @@ if (typeof window !== 'undefined') {
|
|
|
29241
29241
|
// Indicate to webpack that this file can be concatenated
|
|
29242
29242
|
/* harmony default export */ var setPublicPath = (null);
|
|
29243
29243
|
|
|
29244
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
29244
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"aa1018a6-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/com-graphics/index.vue?vue&type=template&id=9d23b864&scoped=true
|
|
29245
29245
|
var com_graphicsvue_type_template_id_9d23b864_scoped_true_render = function render() {
|
|
29246
29246
|
var _vm = this,
|
|
29247
29247
|
_c = _vm._self._c;
|
|
@@ -57197,6 +57197,7 @@ function parseData(input) {
|
|
|
57197
57197
|
type: primitiveData.geomType,
|
|
57198
57198
|
text: primitiveData.geomText,
|
|
57199
57199
|
points: primitiveData.position,
|
|
57200
|
+
alignType: primitiveData.alignType,
|
|
57200
57201
|
normals: primitiveData.normal,
|
|
57201
57202
|
triangles: primitiveData.indices || [],
|
|
57202
57203
|
max: primitiveData.max,
|
|
@@ -59412,6 +59413,27 @@ var GEOM_TYPES = {
|
|
|
59412
59413
|
geom_2d_ellipseArc: 57350,
|
|
59413
59414
|
geom_2d_others: 57351
|
|
59414
59415
|
};
|
|
59416
|
+
|
|
59417
|
+
// 文本对齐枚举
|
|
59418
|
+
var TextAlign = {
|
|
59419
|
+
TextLeftBottom: 0,
|
|
59420
|
+
// 左下角
|
|
59421
|
+
TextLeftMiddle: 1,
|
|
59422
|
+
TextLeftTop: 2,
|
|
59423
|
+
TextCenterBottom: 3,
|
|
59424
|
+
TextCenterMiddle: 4,
|
|
59425
|
+
TextCenterTop: 5,
|
|
59426
|
+
TextRightBottom: 6,
|
|
59427
|
+
TextRightMiddle: 7,
|
|
59428
|
+
TextRightTop: 8,
|
|
59429
|
+
// 右上角
|
|
59430
|
+
TextLeft: 9,
|
|
59431
|
+
TextCenter: 10,
|
|
59432
|
+
TextRight: 11,
|
|
59433
|
+
TextAligned: 12,
|
|
59434
|
+
TextMiddle: 13,
|
|
59435
|
+
TextFit: 14
|
|
59436
|
+
};
|
|
59415
59437
|
var drawObjMapInstance = {};
|
|
59416
59438
|
/**
|
|
59417
59439
|
* 处理 InstancedMesh 类型模型的核心方法
|
|
@@ -59479,6 +59501,16 @@ function handleInstancedMeshModel(modelGroup, instances, drawObjs, type, scene,
|
|
|
59479
59501
|
// m4.setPosition(new THREE.Vector3(9999999, 9999999, 9999999)); // TODO 临时隐藏方案
|
|
59480
59502
|
meshMatrix.elements = item.matrix.val;
|
|
59481
59503
|
geomMatrix.elements = mesh.matrix.val;
|
|
59504
|
+
|
|
59505
|
+
// 处理文本居中对齐
|
|
59506
|
+
var points = mesh.points,
|
|
59507
|
+
alignType = mesh.alignType;
|
|
59508
|
+
if (isTextType(mesh.type)) {
|
|
59509
|
+
var positionMatrix = new Matrix4();
|
|
59510
|
+
var alignMatrix = createAlignedText(alignType, model.geometry);
|
|
59511
|
+
positionMatrix.identity().makeTranslation(points[0], points[1], points[2]);
|
|
59512
|
+
geomMatrix.multiply(alignMatrix).multiply(positionMatrix);
|
|
59513
|
+
}
|
|
59482
59514
|
m4.multiplyMatrices(meshMatrix, geomMatrix);
|
|
59483
59515
|
model.setMatrixAt(index, m4);
|
|
59484
59516
|
var copyMatrix = new Matrix4().copy(m4);
|
|
@@ -59567,7 +59599,7 @@ function instance_parser_drawModel(geom, instanceName, instanceCount, nColor, nO
|
|
|
59567
59599
|
if (geom.type == GEOM_TYPES.geom_2d || geom.type == GEOM_TYPES.geom_2d_others) {
|
|
59568
59600
|
model = draw2Dmodel(geom, instanceName, instanceCount); // TODO 该类型调试中
|
|
59569
59601
|
// 处理二维文本类型
|
|
59570
|
-
} else if (geom.type
|
|
59602
|
+
} else if (isTextType(geom.type)) {
|
|
59571
59603
|
model = drawText(geom, instanceName, instanceCount);
|
|
59572
59604
|
// 处理各种曲线类型(圆形、圆弧、椭圆、椭圆弧)
|
|
59573
59605
|
} else if (geom.type == GEOM_TYPES.geom_2d_circle || geom.type == GEOM_TYPES.geom_2d_arc || geom.type == GEOM_TYPES.geom_2d_ellipse || geom.type == GEOM_TYPES.geom_2d_ellipseArc) {
|
|
@@ -59579,6 +59611,15 @@ function instance_parser_drawModel(geom, instanceName, instanceCount, nColor, nO
|
|
|
59579
59611
|
return model;
|
|
59580
59612
|
}
|
|
59581
59613
|
|
|
59614
|
+
/**
|
|
59615
|
+
* 判断几何类型是否为文本类型
|
|
59616
|
+
* @param {number} type - 几何类型枚举值,参考GEOM_TYPES中的定义
|
|
59617
|
+
* @returns {boolean} 是否为文本类型(2D/3D 单行或多行文本)
|
|
59618
|
+
*/
|
|
59619
|
+
function isTextType(type) {
|
|
59620
|
+
return type == GEOM_TYPES.geom_2d_text || type == GEOM_TYPES.geom_2d_mtext || type == GEOM_TYPES.geom_3d_text || type == GEOM_TYPES.geom_3d_mtext;
|
|
59621
|
+
}
|
|
59622
|
+
|
|
59582
59623
|
/**
|
|
59583
59624
|
* 绘制曲线
|
|
59584
59625
|
*
|
|
@@ -59638,7 +59679,8 @@ function draw3Dmodel(geom, instanceName, instanceCount, nColor, nOpacity) {
|
|
|
59638
59679
|
customMaterial = geom.material,
|
|
59639
59680
|
triangles = geom.triangles,
|
|
59640
59681
|
points = geom.points,
|
|
59641
|
-
normals = geom.normals
|
|
59682
|
+
normals = geom.normals,
|
|
59683
|
+
prop = geom.prop;
|
|
59642
59684
|
// 使用自定义几何体或创建新的缓冲几何体
|
|
59643
59685
|
var geometry = customGeometry || new BufferGeometry();
|
|
59644
59686
|
|
|
@@ -59658,7 +59700,7 @@ function draw3Dmodel(geom, instanceName, instanceCount, nColor, nOpacity) {
|
|
|
59658
59700
|
var normal = new Float32Array(normals);
|
|
59659
59701
|
geometry.setAttribute('normal', new BufferAttribute(normal, 3));
|
|
59660
59702
|
}
|
|
59661
|
-
var color =
|
|
59703
|
+
var color = prop.color;
|
|
59662
59704
|
var material, mesh, colors, opacity;
|
|
59663
59705
|
if (Array.isArray(color) && color.length) {
|
|
59664
59706
|
colors = color;
|
|
@@ -59777,7 +59819,7 @@ function drawText(geom, instanceName, instanceCount) {
|
|
|
59777
59819
|
var options = {
|
|
59778
59820
|
font: font,
|
|
59779
59821
|
// 字体格式
|
|
59780
|
-
size: fontsize || 20,
|
|
59822
|
+
size: fontsize / 2 || 20,
|
|
59781
59823
|
// 字体大小 TODO
|
|
59782
59824
|
height: 1,
|
|
59783
59825
|
// 字体深度
|
|
@@ -59800,10 +59842,10 @@ function drawText(geom, instanceName, instanceCount) {
|
|
|
59800
59842
|
}, instanceName, instanceCount);
|
|
59801
59843
|
|
|
59802
59844
|
// 创建平移矩阵并应用
|
|
59803
|
-
|
|
59804
|
-
|
|
59805
|
-
|
|
59806
|
-
mesh.
|
|
59845
|
+
// const matrix = new THREE.Matrix4();
|
|
59846
|
+
// matrix.identity().makeTranslation(points[0], points[1], points[2]);
|
|
59847
|
+
// mesh.applyMatrix4(matrix);
|
|
59848
|
+
// points && mesh.position.set(points[0], points[1], points[2]);
|
|
59807
59849
|
|
|
59808
59850
|
// if (stageId == STAGE_MODEL_TYPE.PID) {
|
|
59809
59851
|
// mesh.translateX(-(fontsize / 2));
|
|
@@ -59815,12 +59857,90 @@ function drawText(geom, instanceName, instanceCount) {
|
|
|
59815
59857
|
// mesh.rotateY(rotate);
|
|
59816
59858
|
// }
|
|
59817
59859
|
// mesh.rotateX(-Math.PI / 2);
|
|
59818
|
-
mesh.translateX(-(fontsize / 2.5));
|
|
59819
|
-
mesh.translateY(-(fontsize / 2.5));
|
|
59860
|
+
// mesh.translateX(-(fontsize / 2.5));
|
|
59861
|
+
// mesh.translateY(-(fontsize / 2.5));
|
|
59862
|
+
|
|
59820
59863
|
mesh.userData.instanceName = instanceName;
|
|
59821
59864
|
return mesh;
|
|
59822
59865
|
}
|
|
59823
59866
|
|
|
59867
|
+
/**
|
|
59868
|
+
*
|
|
59869
|
+
* @param {number} align 对齐方式
|
|
59870
|
+
* @param {object} geometry 几何体
|
|
59871
|
+
* @returns
|
|
59872
|
+
*/
|
|
59873
|
+
function createAlignedText() {
|
|
59874
|
+
var align = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : TextAlign.TextLeftBottom;
|
|
59875
|
+
var geometry = arguments.length > 1 ? arguments[1] : undefined;
|
|
59876
|
+
// 计算几何体包围盒用于对齐计算
|
|
59877
|
+
geometry.computeBoundingBox();
|
|
59878
|
+
var bbox = geometry.boundingBox;
|
|
59879
|
+
|
|
59880
|
+
// 初始化水平和垂直偏移量
|
|
59881
|
+
var offsetX = 0;
|
|
59882
|
+
var offsetY = 0;
|
|
59883
|
+
|
|
59884
|
+
// 水平对齐处理(X轴方向)
|
|
59885
|
+
switch (align) {
|
|
59886
|
+
// 左对齐系列(文本左边界对齐原点)
|
|
59887
|
+
case TextAlign.TextLeft:
|
|
59888
|
+
case TextAlign.TextLeftBottom:
|
|
59889
|
+
case TextAlign.TextLeftMiddle:
|
|
59890
|
+
case TextAlign.TextLeftTop:
|
|
59891
|
+
offsetX = -bbox.min.x; // 左边界对齐
|
|
59892
|
+
break;
|
|
59893
|
+
|
|
59894
|
+
// 居中对齐系列(文本中心对齐原点)
|
|
59895
|
+
case TextAlign.TextCenter:
|
|
59896
|
+
case TextAlign.TextCenterBottom:
|
|
59897
|
+
case TextAlign.TextCenterMiddle:
|
|
59898
|
+
case TextAlign.TextCenterTop:
|
|
59899
|
+
offsetX = -(bbox.min.x + bbox.max.x) / 2; // 水平居中
|
|
59900
|
+
break;
|
|
59901
|
+
|
|
59902
|
+
// 右对齐系列(文本右边界对齐原点)
|
|
59903
|
+
case TextAlign.TextRight:
|
|
59904
|
+
case TextAlign.TextRightBottom:
|
|
59905
|
+
case TextAlign.TextRightMiddle:
|
|
59906
|
+
case TextAlign.TextRightTop:
|
|
59907
|
+
offsetX = -bbox.max.x; // 右边界对齐
|
|
59908
|
+
break;
|
|
59909
|
+
}
|
|
59910
|
+
|
|
59911
|
+
// 垂直对齐处理(Y轴方向)
|
|
59912
|
+
switch (align) {
|
|
59913
|
+
// 垂直居中系列
|
|
59914
|
+
case TextAlign.TextMiddle:
|
|
59915
|
+
case TextAlign.TextLeftMiddle:
|
|
59916
|
+
case TextAlign.TextCenterMiddle:
|
|
59917
|
+
case TextAlign.TextRightMiddle:
|
|
59918
|
+
offsetY = -(bbox.min.y + bbox.max.y) / 2; // 垂直居中
|
|
59919
|
+
break;
|
|
59920
|
+
|
|
59921
|
+
// 顶部对齐系列
|
|
59922
|
+
case TextAlign.TextTop:
|
|
59923
|
+
case TextAlign.TextLeftTop:
|
|
59924
|
+
case TextAlign.TextCenterTop:
|
|
59925
|
+
case TextAlign.TextRightTop:
|
|
59926
|
+
offsetY = -bbox.max.y; // 顶部对齐
|
|
59927
|
+
break;
|
|
59928
|
+
|
|
59929
|
+
// 底部对齐系列
|
|
59930
|
+
case TextAlign.TextBottom:
|
|
59931
|
+
case TextAlign.TextLeftBottom:
|
|
59932
|
+
case TextAlign.TextCenterBottom:
|
|
59933
|
+
case TextAlign.TextRightBottom:
|
|
59934
|
+
offsetY = -bbox.min.y; // 底部对齐
|
|
59935
|
+
break;
|
|
59936
|
+
}
|
|
59937
|
+
|
|
59938
|
+
// 创建对齐变换矩阵
|
|
59939
|
+
var alignMatrix = new Matrix4();
|
|
59940
|
+
alignMatrix.identity().makeTranslation(offsetX, offsetY, 0);
|
|
59941
|
+
return alignMatrix;
|
|
59942
|
+
}
|
|
59943
|
+
|
|
59824
59944
|
// CONCATENATED MODULE: ./src/utils/threejs/rain-shader.js
|
|
59825
59945
|
|
|
59826
59946
|
var RainShader = {
|
|
@@ -62481,7 +62601,7 @@ var component = normalizeComponent(
|
|
|
62481
62601
|
)
|
|
62482
62602
|
|
|
62483
62603
|
/* harmony default export */ var com_graphics = (component.exports);
|
|
62484
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
62604
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"aa1018a6-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/com-flcanvas/index.vue?vue&type=template&id=1eba8e28&scoped=true
|
|
62485
62605
|
var com_flcanvasvue_type_template_id_1eba8e28_scoped_true_render = function render() {
|
|
62486
62606
|
var _vm = this,
|
|
62487
62607
|
_c = _vm._self._c;
|
|
@@ -65680,7 +65800,7 @@ var com_flcanvas_component = normalizeComponent(
|
|
|
65680
65800
|
)
|
|
65681
65801
|
|
|
65682
65802
|
/* harmony default export */ var com_flcanvas = (com_flcanvas_component.exports);
|
|
65683
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
65803
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"aa1018a6-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/com-graphics/per-control.vue?vue&type=template&id=f547d5c6&scoped=true
|
|
65684
65804
|
var per_controlvue_type_template_id_f547d5c6_scoped_true_render = function render() {
|
|
65685
65805
|
var _vm = this,
|
|
65686
65806
|
_c = _vm._self._c;
|
|
@@ -65788,7 +65908,7 @@ var per_control_component = normalizeComponent(
|
|
|
65788
65908
|
)
|
|
65789
65909
|
|
|
65790
65910
|
/* harmony default export */ var per_control = (per_control_component.exports);
|
|
65791
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
65911
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"aa1018a6-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/com-graphics/pid.vue?vue&type=template&id=0ec35ee4&scoped=true
|
|
65792
65912
|
var pidvue_type_template_id_0ec35ee4_scoped_true_render = function render() {
|
|
65793
65913
|
var _vm = this,
|
|
65794
65914
|
_c = _vm._self._c;
|