file-viewer3 1.0.26 → 2.0.0
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.en.md +7 -377
- package/README.md +8 -352
- package/dist/file-viewer3.css +1 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/package.json +27 -129
- package/dist/components/3MFLoader.js +0 -527
- package/dist/components/AMFLoader.js +0 -188
- package/dist/components/ArchiveViewer.js +0 -526
- package/dist/components/AudioViewer.js +0 -66
- package/dist/components/CadViewer.js +0 -9040
- package/dist/components/CodeViewer.js +0 -151
- package/dist/components/ColladaLoader.js +0 -2282
- package/dist/components/DrawingViewer.js +0 -295
- package/dist/components/EdaViewer.js +0 -630
- package/dist/components/EmailViewer.js +0 -276
- package/dist/components/EpubViewer.js +0 -172
- package/dist/components/FBXLoader.js +0 -1574
- package/dist/components/GLTFLoader.js +0 -1383
- package/dist/components/ImageViewer.js +0 -1519
- package/dist/components/KMZLoader.js +0 -45
- package/dist/components/MarkdownViewer.js +0 -1476
- package/dist/components/ModelViewer.js +0 -797
- package/dist/components/OBJLoader.js +0 -287
- package/dist/components/OfdViewer.js +0 -133
- package/dist/components/PCDLoader.js +0 -141
- package/dist/components/PLYLoader.js +0 -305
- package/dist/components/PdfView.js +0 -27667
- package/dist/components/PptxRender.js +0 -11217
- package/dist/components/STLLoader.js +0 -83
- package/dist/components/TDSLoader.js +0 -228
- package/dist/components/TypstViewer.js +0 -1697
- package/dist/components/USDLoader.js +0 -2526
- package/dist/components/UmdViewer.js +0 -1873
- package/dist/components/VRMLLoader.js +0 -6422
- package/dist/components/VTKLoader.js +0 -337
- package/dist/components/XYZLoader.js +0 -30
- package/dist/components/XlsxTable.js +0 -7879
- package/dist/components/__vite-browser-external.js +0 -7
- package/dist/components/_plugin-vue_export-helper.js +0 -8
- package/dist/components/ar-SA-G6X2FPQ2.js +0 -523
- package/dist/components/arc.js +0 -79
- package/dist/components/architecture-7EHR7CIX.js +0 -3
- package/dist/components/architectureDiagram-3BPJPVTR.js +0 -4096
- package/dist/components/archive.js +0 -24
- package/dist/components/asyncToGenerator.js +0 -29
- package/dist/components/audio.js +0 -19
- package/dist/components/az-AZ-76LH7QW2.js +0 -523
- package/dist/components/bash.js +0 -169
- package/dist/components/bg-BG-XCXSNQG7.js +0 -523
- package/dist/components/blockDiagram-GPEHLZMM.js +0 -3357
- package/dist/components/bn-BD-2XOGV67Q.js +0 -523
- package/dist/components/c4Diagram-AAUBKEIU.js +0 -2957
- package/dist/components/ca-ES-6MX7JW3Y.js +0 -523
- package/dist/components/cad.js +0 -23
- package/dist/components/cfb.js +0 -1174
- package/dist/components/channel.js +0 -5
- package/dist/components/chunk-2J33WTMH.js +0 -26
- package/dist/components/chunk-3OPIFGDE.js +0 -4167
- package/dist/components/chunk-4BX2VUAB.js +0 -19
- package/dist/components/chunk-55IACEB6.js +0 -9
- package/dist/components/chunk-5ZQYHXKU.js +0 -669
- package/dist/components/chunk-6U3AYISY.js +0 -624
- package/dist/components/chunk-727SXJPM.js +0 -3356
- package/dist/components/chunk-AGHRB4JF.js +0 -324
- package/dist/components/chunk-AQP2D5EJ.js +0 -2055
- package/dist/components/chunk-BSJP7CBP.js +0 -83
- package/dist/components/chunk-CSCIHK7Q.js +0 -3500
- package/dist/components/chunk-EIO257PC.js +0 -1836
- package/dist/components/chunk-FMBD7UC4.js +0 -5
- package/dist/components/chunk-K2UTITRG.js +0 -17627
- package/dist/components/chunk-KSCS5N6A.js +0 -572
- package/dist/components/chunk-L5ZTLDWV.js +0 -40
- package/dist/components/chunk-LZXEDZCA.js +0 -60
- package/dist/components/chunk-ND2GUHAM.js +0 -61
- package/dist/components/chunk-NNHCCRGN.js +0 -20425
- package/dist/components/chunk-NZK2D7GU.js +0 -68
- package/dist/components/chunk-O5CBEL6O.js +0 -1894
- package/dist/components/chunk-QZHKN3VN.js +0 -12
- package/dist/components/chunk-SRAX5OIU.js +0 -22
- package/dist/components/chunk-WU5MYG2G.js +0 -14
- package/dist/components/chunk-XPW4576I.js +0 -1146
- package/dist/components/chunk-Z3N5DIM6.js +0 -59
- package/dist/components/chunk-ZUYEQ4TG.js +0 -22
- package/dist/components/chunk.js +0 -23
- package/dist/components/classDiagram-4FO5ZUOK.js +0 -29
- package/dist/components/classDiagram-v2-Q7XG4LA2.js +0 -29
- package/dist/components/compiler.js +0 -2
- package/dist/components/core.js +0 -845
- package/dist/components/cose-bilkent-S5V4N54A.js +0 -2268
- package/dist/components/cpp.js +0 -225
- package/dist/components/cs-CZ-2BRQDIVT.js +0 -523
- package/dist/components/csharp.js +0 -260
- package/dist/components/css.js +0 -140
- package/dist/components/cytoscape.esm.js +0 -18114
- package/dist/components/da-DK-5WZEPLOC.js +0 -523
- package/dist/components/dagre-BM42HDAG.js +0 -325
- package/dist/components/dagre.js +0 -1936
- package/dist/components/de-DE-XR44H4JA.js +0 -523
- package/dist/components/defaultLocale.js +0 -201
- package/dist/components/defineProperty.js +0 -50
- package/dist/components/diagram-2AECGRRQ.js +0 -229
- package/dist/components/diagram-5GNKFQAL.js +0 -108
- package/dist/components/diagram-KO2AKTUF.js +0 -443
- package/dist/components/diagram-LMA3HP47.js +0 -139
- package/dist/components/diagram-OG6HWLK6.js +0 -541
- package/dist/components/diff.js +0 -39
- package/dist/components/directory-open-01563666.js +0 -26
- package/dist/components/directory-open-4ed118d0.js +0 -83
- package/dist/components/dist.js +0 -50
- package/dist/components/dist2.js +0 -3291
- package/dist/components/dist3.js +0 -1593
- package/dist/components/documentSearch.js +0 -378
- package/dist/components/docx-preview.js +0 -3113
- package/dist/components/drawing.js +0 -19
- package/dist/components/ebook.js +0 -16
- package/dist/components/eda.js +0 -20
- package/dist/components/el-GR-BZB4AONW.js +0 -523
- package/dist/components/email.js +0 -21
- package/dist/components/en-B4ZKOASM.js +0 -3
- package/dist/components/erDiagram-TEJ5UH35.js +0 -1719
- package/dist/components/es-ES-U4NZUMDT.js +0 -523
- package/dist/components/eu-ES-A7QVB2H4.js +0 -523
- package/dist/components/eventmodeling-FCH6USID.js +0 -3
- package/dist/components/fa-IR-HGAKTJCU.js +0 -523
- package/dist/components/fflate.module.js +0 -323
- package/dist/components/fi-FI-Z5N7JZ37.js +0 -523
- package/dist/components/file-open-002ab408.js +0 -38
- package/dist/components/file-open-7c801643.js +0 -24
- package/dist/components/file-save-3189631c.js +0 -40
- package/dist/components/file-save-745eba88.js +0 -36
- package/dist/components/flowDiagram-I6XJVG4X.js +0 -4181
- package/dist/components/fr-FR-RHASNOE6.js +0 -523
- package/dist/components/ganttDiagram-6RSMTGT7.js +0 -2182
- package/dist/components/gitGraph-WXDBUCRP.js +0 -3
- package/dist/components/gitGraphDiagram-PVQCEYII.js +0 -788
- package/dist/components/gl-ES-HMX3MZ6V.js +0 -523
- package/dist/components/global-compiler.js +0 -23
- package/dist/components/global-renderer.js +0 -23
- package/dist/components/go.js +0 -140
- package/dist/components/graphlib.js +0 -1267
- package/dist/components/he-IL-6SHJWFNN.js +0 -523
- package/dist/components/hi-IN-IWLTKZ5I.js +0 -523
- package/dist/components/hu-HU-A5ZG7DT2.js +0 -523
- package/dist/components/id-ID-SAP4L64H.js +0 -523
- package/dist/components/image-GAAHSSAO.js +0 -3
- package/dist/components/image-blob-reduce.esm.js +0 -1429
- package/dist/components/image.js +0 -17
- package/dist/components/info-J43DQDTF.js +0 -3
- package/dist/components/infoDiagram-5YYISTIA.js +0 -26
- package/dist/components/ini.js +0 -88
- package/dist/components/init.js +0 -15
- package/dist/components/ishikawaDiagram-YF4QCWOH.js +0 -718
- package/dist/components/it-IT-JPQ66NNP.js +0 -523
- package/dist/components/ja-JP-DBVTYXUO.js +0 -523
- package/dist/components/java.js +0 -169
- package/dist/components/javascript.js +0 -436
- package/dist/components/journeyDiagram-JHISSGLW.js +0 -885
- package/dist/components/json.js +0 -36
- package/dist/components/jszip.min.js +0 -3033
- package/dist/components/kaa-6HZHGXH3.js +0 -523
- package/dist/components/kab-KAB-ZGHBKWFO.js +0 -523
- package/dist/components/kanban-definition-UN3LZRKU.js +0 -986
- package/dist/components/katex.js +0 -21979
- package/dist/components/kk-KZ-P5N5QNE5.js +0 -523
- package/dist/components/km-KH-HSX4SM5Z.js +0 -523
- package/dist/components/ko-KR-MTYHY66A.js +0 -523
- package/dist/components/ku-TR-6OUDTVRD.js +0 -523
- package/dist/components/lib.js +0 -4877
- package/dist/components/libarchive.js +0 -360
- package/dist/components/linear.js +0 -289
- package/dist/components/lt-LT-XHIRWOB4.js +0 -523
- package/dist/components/lv-LV-5QDEKY6T.js +0 -523
- package/dist/components/markdown.js +0 -181
- package/dist/components/md.js +0 -17
- package/dist/components/mermaid-parser.core.js +0 -328
- package/dist/components/mindmap-definition-RKZ34NQL.js +0 -1016
- package/dist/components/model.js +0 -21
- package/dist/components/mp4.js +0 -12
- package/dist/components/mr-IN-CRQNXWMA.js +0 -523
- package/dist/components/my-MM-5M5IBNSE.js +0 -523
- package/dist/components/nb-NO-T6EIAALU.js +0 -523
- package/dist/components/nestedRender.js +0 -158
- package/dist/components/nl-NL-IS3SIHDZ.js +0 -523
- package/dist/components/nn-NO-6E72VCQL.js +0 -523
- package/dist/components/objectSpread2.js +0 -29
- package/dist/components/objectWithoutProperties.js +0 -28
- package/dist/components/oc-FR-POXYY2M6.js +0 -523
- package/dist/components/ofd.js +0 -5261
- package/dist/components/ofd2.js +0 -16
- package/dist/components/ordinal.js +0 -65
- package/dist/components/pa-IN-N4M65BXN.js +0 -523
- package/dist/components/packet-YPE3B663.js +0 -3
- package/dist/components/pdf.js +0 -24
- package/dist/components/percentages-BXMCSKIN.js +0 -3
- package/dist/components/php.js +0 -294
- package/dist/components/pica.js +0 -1009
- package/dist/components/pie-LRSECV5Y.js +0 -3
- package/dist/components/pie.js +0 -47
- package/dist/components/pieDiagram-4H26LBE5.js +0 -130
- package/dist/components/pl-PL-T2D74RX3.js +0 -523
- package/dist/components/postal-mime.js +0 -3146
- package/dist/components/pptx.js +0 -15
- package/dist/components/printLayout.js +0 -42
- package/dist/components/prod.js +0 -21770
- package/dist/components/pt-BR-5N22H2LF.js +0 -523
- package/dist/components/pt-PT-UZXXM6DQ.js +0 -523
- package/dist/components/python.js +0 -238
- package/dist/components/quadrantDiagram-W4KKPZXB.js +0 -1988
- package/dist/components/radar-GUYGQ44K.js +0 -3
- package/dist/components/renderer.js +0 -2
- package/dist/components/requirementDiagram-4Y6WPE33.js +0 -2230
- package/dist/components/ro-RO-JPDTUUEW.js +0 -523
- package/dist/components/rough.esm.js +0 -1355
- package/dist/components/roundRect.js +0 -90
- package/dist/components/ru-RU-B4JR7IUQ.js +0 -523
- package/dist/components/rust.js +0 -169
- package/dist/components/sankeyDiagram-5OEKKPKP.js +0 -972
- package/dist/components/sequenceDiagram-3UESZ5HK.js +0 -4255
- package/dist/components/shared.js +0 -175
- package/dist/components/shared2.js +0 -4
- package/dist/components/si-LK-N5RQ5JYF.js +0 -523
- package/dist/components/sk-SK-C5VTKIMK.js +0 -523
- package/dist/components/sl-SI-NN7IZMDC.js +0 -523
- package/dist/components/sourceLoading.js +0 -134
- package/dist/components/sql.js +0 -118
- package/dist/components/src.js +0 -2664
- package/dist/components/src2.js +0 -10722
- package/dist/components/stateDiagram-AJRCARHV.js +0 -217
- package/dist/components/stateDiagram-v2-BHNVJYJU.js +0 -27
- package/dist/components/subset-shared.chunk.js +0 -3
- package/dist/components/subset-worker.chunk.js +0 -21
- package/dist/components/sv-SE-XGPEYMSR.js +0 -523
- package/dist/components/ta-IN-2NMHFXQM.js +0 -523
- package/dist/components/text.js +0 -20
- package/dist/components/th-TH-HPSO5L25.js +0 -523
- package/dist/components/three.module.js +0 -13134
- package/dist/components/time.js +0 -910
- package/dist/components/timeline-definition-PNZ67QCA.js +0 -1084
- package/dist/components/tr-TR-DEFEU3FU.js +0 -523
- package/dist/components/treeView-BLDUP644.js +0 -3
- package/dist/components/treemap-LRROVOQU.js +0 -3
- package/dist/components/typescript.js +0 -521
- package/dist/components/typst.js +0 -25
- package/dist/components/uk-UA-QMV73CPH.js +0 -523
- package/dist/components/umd.js +0 -16
- package/dist/components/use.js +0 -422
- package/dist/components/util.js +0 -49
- package/dist/components/vennDiagram-CIIHVFJN.js +0 -1880
- package/dist/components/vi-VN-M7AON7JQ.js +0 -523
- package/dist/components/viewerZoom.js +0 -92
- package/dist/components/wardley-L42UT6IY.js +0 -3
- package/dist/components/wardleyDiagram-YWT4CUSO.js +0 -656
- package/dist/components/wasm-pack-shim.js +0 -1711
- package/dist/components/wasm-pack-shim2.js +0 -934
- package/dist/components/wasm.js +0 -97
- package/dist/components/word.js +0 -3055
- package/dist/components/worker-ref.js +0 -16
- package/dist/components/xlsx.js +0 -21
- package/dist/components/xml.js +0 -166
- package/dist/components/xychartDiagram-2RQKCTM6.js +0 -2015
- package/dist/components/yaml.js +0 -144
- package/dist/components/zh-CN-LNUGB5OW.js +0 -523
- package/dist/components/zh-HK-E62DVLB3.js +0 -523
- package/dist/components/zh-TW-RAJ6MFWO.js +0 -523
- package/dist/index.mjs +0 -3293
- package/dist/src/App.vue.d.ts +0 -3
- package/dist/src/compare/CompareApp.vue.d.ts +0 -3
- package/dist/src/compare/main.d.ts +0 -0
- package/dist/src/compare/useSynchronizedScroll.d.ts +0 -7
- package/dist/src/components/HelloWorld.vue.d.ts +0 -3
- package/dist/src/components/utils.d.ts +0 -4
- package/dist/src/main.d.ts +0 -0
- package/dist/src/package/common/printCapability.d.ts +0 -27
- package/dist/src/package/common/printLayout.d.ts +0 -16
- package/dist/src/package/common/sourceLoading.d.ts +0 -10
- package/dist/src/package/common/type.d.ts +0 -544
- package/dist/src/package/common/util.d.ts +0 -5
- package/dist/src/package/common/worker-ref.d.ts +0 -12
- package/dist/src/package/components/FileViewer/FileViewer.vue.d.ts +0 -75
- package/dist/src/package/components/FileViewer/exportDocumentTemplate.d.ts +0 -9
- package/dist/src/package/components/FileViewer/hooks/useViewerDocumentFeatures.d.ts +0 -29
- package/dist/src/package/components/FileViewer/hooks/useViewerExport.d.ts +0 -21
- package/dist/src/package/components/FileViewer/hooks/useViewerWatermark.d.ts +0 -8
- package/dist/src/package/components/FileViewer/hooks/useViewerZoom.d.ts +0 -34
- package/dist/src/package/components/FileViewer/index.d.ts +0 -2
- package/dist/src/package/components/FileViewer/util.d.ts +0 -3
- package/dist/src/package/index.d.ts +0 -22
- package/dist/src/package/use/documentLocation.d.ts +0 -15
- package/dist/src/package/use/documentSearch.d.ts +0 -234
- package/dist/src/package/use/index.d.ts +0 -5
- package/dist/src/package/use/loading.d.ts +0 -33
- package/dist/src/package/use/viewerZoom.d.ts +0 -42
- package/dist/src/package/use/worker.d.ts +0 -24
- package/dist/src/package/vendors/archive/ArchiveViewer.vue.d.ts +0 -9
- package/dist/src/package/vendors/archive/cache.d.ts +0 -10
- package/dist/src/package/vendors/archive/fallback.d.ts +0 -9
- package/dist/src/package/vendors/archive/index.d.ts +0 -3
- package/dist/src/package/vendors/archive/shared.d.ts +0 -24
- package/dist/src/package/vendors/audio/AudioViewer.vue.d.ts +0 -7
- package/dist/src/package/vendors/audio/index.d.ts +0 -7
- package/dist/src/package/vendors/cad/CadViewer.vue.d.ts +0 -9
- package/dist/src/package/vendors/cad/index.d.ts +0 -8
- package/dist/src/package/vendors/drawing/DrawingViewer.vue.d.ts +0 -15
- package/dist/src/package/vendors/drawing/index.d.ts +0 -7
- package/dist/src/package/vendors/ebook/EpubViewer.vue.d.ts +0 -6
- package/dist/src/package/vendors/ebook/index.d.ts +0 -7
- package/dist/src/package/vendors/eda/EdaViewer.vue.d.ts +0 -8
- package/dist/src/package/vendors/eda/index.d.ts +0 -2
- package/dist/src/package/vendors/eda/parser.d.ts +0 -77
- package/dist/src/package/vendors/email/EmailViewer.vue.d.ts +0 -10
- package/dist/src/package/vendors/email/index.d.ts +0 -2
- package/dist/src/package/vendors/image/ImageViewer.vue.d.ts +0 -6
- package/dist/src/package/vendors/image/index.d.ts +0 -4
- package/dist/src/package/vendors/md/MarkdownViewer.vue.d.ts +0 -6
- package/dist/src/package/vendors/md/index.d.ts +0 -4
- package/dist/src/package/vendors/model/ModelViewer.vue.d.ts +0 -8
- package/dist/src/package/vendors/model/index.d.ts +0 -3
- package/dist/src/package/vendors/model/shared.d.ts +0 -1
- package/dist/src/package/vendors/mp4/index.d.ts +0 -4
- package/dist/src/package/vendors/nestedRender.d.ts +0 -10
- package/dist/src/package/vendors/ofd/OfdViewer.vue.d.ts +0 -6
- package/dist/src/package/vendors/ofd/index.d.ts +0 -7
- package/dist/src/package/vendors/pdf/PdfView.vue.d.ts +0 -10
- package/dist/src/package/vendors/pdf/index.d.ts +0 -2
- package/dist/src/package/vendors/pdf/worker/index.d.ts +0 -4
- package/dist/src/package/vendors/pdf/worker/pdf.worker.d.ts +0 -0
- package/dist/src/package/vendors/pptx/PptxRender.vue.d.ts +0 -9
- package/dist/src/package/vendors/pptx/index.d.ts +0 -6
- package/dist/src/package/vendors/pptx/options.d.ts +0 -39
- package/dist/src/package/vendors/pptx/support/chart.d.ts +0 -4
- package/dist/src/package/vendors/pptx/worker/index.d.ts +0 -4
- package/dist/src/package/vendors/renders.d.ts +0 -3
- package/dist/src/package/vendors/text/CodeViewer.vue.d.ts +0 -7
- package/dist/src/package/vendors/text/index.d.ts +0 -10
- package/dist/src/package/vendors/typst/TypstViewer.vue.d.ts +0 -15
- package/dist/src/package/vendors/typst/index.d.ts +0 -8
- package/dist/src/package/vendors/umd/UmdViewer.vue.d.ts +0 -6
- package/dist/src/package/vendors/umd/index.d.ts +0 -7
- package/dist/src/package/vendors/umd/parser.d.ts +0 -30
- package/dist/src/package/vendors/word/doc.d.ts +0 -5
- package/dist/src/package/vendors/word/docx.d.ts +0 -5
- package/dist/src/package/vendors/word/docx.worker.d.ts +0 -1
- package/dist/src/package/vendors/word/index.d.ts +0 -3
- package/dist/src/package/vendors/xlsx/XlsxTable.state.d.ts +0 -80
- package/dist/src/package/vendors/xlsx/XlsxTable.view.d.ts +0 -25
- package/dist/src/package/vendors/xlsx/XlsxTable.vue.d.ts +0 -6
- package/dist/src/package/vendors/xlsx/index.d.ts +0 -6
- package/dist/src/package/vendors/xlsx/util.d.ts +0 -3
- package/dist/src/package/vendors/xlsx/worker/index.d.ts +0 -4
- package/dist/src/package/vendors/xlsx/worker/sheetjs/SheetJsModel.d.ts +0 -73
- package/dist/src/package/vendors/xlsx/worker/sheetjs/color.d.ts +0 -2
- package/dist/src/package/vendors/xlsx/worker/sheetjs/index.d.ts +0 -4
- package/dist/src/package/vendors/xlsx/worker/sheetjs/sheet.worker.d.ts +0 -1
- package/dist/style.css +0 -1
- package/dist/wasm/cad/dwfv-render.wasm +0 -0
- package/dist/wasm/cad/dwg-worker.js +0 -24
- package/dist/wasm/cad/libredwg-web.js +0 -15
- package/dist/wasm/cad/libredwg-web.wasm +0 -0
|
@@ -1,287 +0,0 @@
|
|
|
1
|
-
import { Bt as e, C as t, E as n, K as r, V as i, X as a, _t as o, et as s, gt as c, p as l, rt as u, u as d, w as f, wt as p, z as m } from "./three.module.js";
|
|
2
|
-
//#region node_modules/.pnpm/three@0.184.0/node_modules/three/examples/jsm/loaders/OBJLoader.js
|
|
3
|
-
var h = /^[og]\s*(.+)?/, g = /^mtllib /, _ = /^usemtl /, v = /^usemap /, y = /\s+/, b = new e(), x = new e(), S = new e(), C = new e(), w = new e(), T = new l();
|
|
4
|
-
function E() {
|
|
5
|
-
let e = {
|
|
6
|
-
objects: [],
|
|
7
|
-
object: {},
|
|
8
|
-
vertices: [],
|
|
9
|
-
normals: [],
|
|
10
|
-
colors: [],
|
|
11
|
-
uvs: [],
|
|
12
|
-
materials: {},
|
|
13
|
-
materialLibraries: [],
|
|
14
|
-
startObject: function(e, t) {
|
|
15
|
-
if (this.object && this.object.fromDeclaration === !1) {
|
|
16
|
-
this.object.name = e, this.object.fromDeclaration = t !== !1;
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
let n = this.object && typeof this.object.currentMaterial == "function" ? this.object.currentMaterial() : void 0;
|
|
20
|
-
if (this.object && typeof this.object._finalize == "function" && this.object._finalize(!0), this.object = {
|
|
21
|
-
name: e || "",
|
|
22
|
-
fromDeclaration: t !== !1,
|
|
23
|
-
geometry: {
|
|
24
|
-
vertices: [],
|
|
25
|
-
normals: [],
|
|
26
|
-
colors: [],
|
|
27
|
-
uvs: [],
|
|
28
|
-
hasUVIndices: !1
|
|
29
|
-
},
|
|
30
|
-
materials: [],
|
|
31
|
-
smooth: !0,
|
|
32
|
-
startMaterial: function(e, t) {
|
|
33
|
-
let n = this._finalize(!1);
|
|
34
|
-
n && (n.inherited || n.groupCount <= 0) && this.materials.splice(n.index, 1);
|
|
35
|
-
let r = {
|
|
36
|
-
index: this.materials.length,
|
|
37
|
-
name: e || "",
|
|
38
|
-
mtllib: Array.isArray(t) && t.length > 0 ? t[t.length - 1] : "",
|
|
39
|
-
smooth: n === void 0 ? this.smooth : n.smooth,
|
|
40
|
-
groupStart: n === void 0 ? 0 : n.groupEnd,
|
|
41
|
-
groupEnd: -1,
|
|
42
|
-
groupCount: -1,
|
|
43
|
-
inherited: !1,
|
|
44
|
-
clone: function(e) {
|
|
45
|
-
let t = {
|
|
46
|
-
index: typeof e == "number" ? e : this.index,
|
|
47
|
-
name: this.name,
|
|
48
|
-
mtllib: this.mtllib,
|
|
49
|
-
smooth: this.smooth,
|
|
50
|
-
groupStart: 0,
|
|
51
|
-
groupEnd: -1,
|
|
52
|
-
groupCount: -1,
|
|
53
|
-
inherited: !1
|
|
54
|
-
};
|
|
55
|
-
return t.clone = this.clone.bind(t), t;
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
return this.materials.push(r), r;
|
|
59
|
-
},
|
|
60
|
-
currentMaterial: function() {
|
|
61
|
-
if (this.materials.length > 0) return this.materials[this.materials.length - 1];
|
|
62
|
-
},
|
|
63
|
-
_finalize: function(e) {
|
|
64
|
-
let t = this.currentMaterial();
|
|
65
|
-
if (t && t.groupEnd === -1 && (t.groupEnd = this.geometry.vertices.length / 3, t.groupCount = t.groupEnd - t.groupStart, t.inherited = !1), e && this.materials.length > 1) for (let e = this.materials.length - 1; e >= 0; e--) this.materials[e].groupCount <= 0 && this.materials.splice(e, 1);
|
|
66
|
-
return e && this.materials.length === 0 && this.materials.push({
|
|
67
|
-
name: "",
|
|
68
|
-
smooth: this.smooth
|
|
69
|
-
}), t;
|
|
70
|
-
}
|
|
71
|
-
}, n && n.name && typeof n.clone == "function") {
|
|
72
|
-
let e = n.clone(0);
|
|
73
|
-
e.inherited = !0, this.object.materials.push(e);
|
|
74
|
-
}
|
|
75
|
-
this.objects.push(this.object);
|
|
76
|
-
},
|
|
77
|
-
finalize: function() {
|
|
78
|
-
this.object && typeof this.object._finalize == "function" && this.object._finalize(!0);
|
|
79
|
-
},
|
|
80
|
-
parseVertexIndex: function(e, t) {
|
|
81
|
-
let n = parseInt(e, 10);
|
|
82
|
-
return (n >= 0 ? n - 1 : n + t / 3) * 3;
|
|
83
|
-
},
|
|
84
|
-
parseNormalIndex: function(e, t) {
|
|
85
|
-
let n = parseInt(e, 10);
|
|
86
|
-
return (n >= 0 ? n - 1 : n + t / 3) * 3;
|
|
87
|
-
},
|
|
88
|
-
parseUVIndex: function(e, t) {
|
|
89
|
-
let n = parseInt(e, 10);
|
|
90
|
-
return (n >= 0 ? n - 1 : n + t / 2) * 2;
|
|
91
|
-
},
|
|
92
|
-
addVertex: function(e, t, n) {
|
|
93
|
-
let r = this.vertices, i = this.object.geometry.vertices;
|
|
94
|
-
i.push(r[e + 0], r[e + 1], r[e + 2]), i.push(r[t + 0], r[t + 1], r[t + 2]), i.push(r[n + 0], r[n + 1], r[n + 2]);
|
|
95
|
-
},
|
|
96
|
-
addVertexPoint: function(e) {
|
|
97
|
-
let t = this.vertices;
|
|
98
|
-
this.object.geometry.vertices.push(t[e + 0], t[e + 1], t[e + 2]);
|
|
99
|
-
},
|
|
100
|
-
addVertexLine: function(e) {
|
|
101
|
-
let t = this.vertices;
|
|
102
|
-
this.object.geometry.vertices.push(t[e + 0], t[e + 1], t[e + 2]);
|
|
103
|
-
},
|
|
104
|
-
addNormal: function(e, t, n) {
|
|
105
|
-
let r = this.normals, i = this.object.geometry.normals;
|
|
106
|
-
i.push(r[e + 0], r[e + 1], r[e + 2]), i.push(r[t + 0], r[t + 1], r[t + 2]), i.push(r[n + 0], r[n + 1], r[n + 2]);
|
|
107
|
-
},
|
|
108
|
-
addFaceNormal: function(e, t, n) {
|
|
109
|
-
let r = this.vertices, i = this.object.geometry.normals;
|
|
110
|
-
b.fromArray(r, e), x.fromArray(r, t), S.fromArray(r, n), w.subVectors(S, x), C.subVectors(b, x), w.cross(C), w.normalize(), i.push(w.x, w.y, w.z), i.push(w.x, w.y, w.z), i.push(w.x, w.y, w.z);
|
|
111
|
-
},
|
|
112
|
-
addColor: function(e, t, n) {
|
|
113
|
-
let r = this.colors, i = this.object.geometry.colors;
|
|
114
|
-
r[e] !== void 0 && i.push(r[e + 0], r[e + 1], r[e + 2]), r[t] !== void 0 && i.push(r[t + 0], r[t + 1], r[t + 2]), r[n] !== void 0 && i.push(r[n + 0], r[n + 1], r[n + 2]);
|
|
115
|
-
},
|
|
116
|
-
addUV: function(e, t, n) {
|
|
117
|
-
let r = this.uvs, i = this.object.geometry.uvs;
|
|
118
|
-
i.push(r[e + 0], r[e + 1]), i.push(r[t + 0], r[t + 1]), i.push(r[n + 0], r[n + 1]);
|
|
119
|
-
},
|
|
120
|
-
addDefaultUV: function() {
|
|
121
|
-
let e = this.object.geometry.uvs;
|
|
122
|
-
e.push(0, 0), e.push(0, 0), e.push(0, 0);
|
|
123
|
-
},
|
|
124
|
-
addUVLine: function(e) {
|
|
125
|
-
let t = this.uvs;
|
|
126
|
-
this.object.geometry.uvs.push(t[e + 0], t[e + 1]);
|
|
127
|
-
},
|
|
128
|
-
addFace: function(e, t, n, r, i, a, o, s, c) {
|
|
129
|
-
let l = this.vertices.length, u = this.parseVertexIndex(e, l), d = this.parseVertexIndex(t, l), f = this.parseVertexIndex(n, l);
|
|
130
|
-
if (this.addVertex(u, d, f), this.addColor(u, d, f), o !== void 0 && o !== "") {
|
|
131
|
-
let e = this.normals.length;
|
|
132
|
-
u = this.parseNormalIndex(o, e), d = this.parseNormalIndex(s, e), f = this.parseNormalIndex(c, e), this.addNormal(u, d, f);
|
|
133
|
-
} else this.addFaceNormal(u, d, f);
|
|
134
|
-
if (r !== void 0 && r !== "") {
|
|
135
|
-
let e = this.uvs.length;
|
|
136
|
-
u = this.parseUVIndex(r, e), d = this.parseUVIndex(i, e), f = this.parseUVIndex(a, e), this.addUV(u, d, f), this.object.geometry.hasUVIndices = !0;
|
|
137
|
-
} else this.addDefaultUV();
|
|
138
|
-
},
|
|
139
|
-
addPointGeometry: function(e) {
|
|
140
|
-
this.object.geometry.type = "Points";
|
|
141
|
-
let t = this.vertices.length;
|
|
142
|
-
for (let n = 0, r = e.length; n < r; n++) {
|
|
143
|
-
let r = this.parseVertexIndex(e[n], t);
|
|
144
|
-
this.addVertexPoint(r), this.addColor(r);
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
addLineGeometry: function(e, t) {
|
|
148
|
-
this.object.geometry.type = "Line";
|
|
149
|
-
let n = this.vertices.length, r = this.uvs.length;
|
|
150
|
-
for (let t = 0, r = e.length; t < r; t++) this.addVertexLine(this.parseVertexIndex(e[t], n));
|
|
151
|
-
for (let e = 0, n = t.length; e < n; e++) this.addUVLine(this.parseUVIndex(t[e], r));
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
return e.startObject("", !1), e;
|
|
155
|
-
}
|
|
156
|
-
var D = class extends r {
|
|
157
|
-
constructor(e) {
|
|
158
|
-
super(e), this.materials = null;
|
|
159
|
-
}
|
|
160
|
-
load(e, n, r, i) {
|
|
161
|
-
let a = this, o = new t(this.manager);
|
|
162
|
-
o.setPath(this.path), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(e, function(t) {
|
|
163
|
-
try {
|
|
164
|
-
n(a.parse(t));
|
|
165
|
-
} catch (t) {
|
|
166
|
-
i ? i(t) : console.error(t), a.manager.itemError(e);
|
|
167
|
-
}
|
|
168
|
-
}, r, i);
|
|
169
|
-
}
|
|
170
|
-
setMaterials(e) {
|
|
171
|
-
return this.materials = e, this;
|
|
172
|
-
}
|
|
173
|
-
parse(e) {
|
|
174
|
-
let t = new E();
|
|
175
|
-
e.indexOf("\r\n") !== -1 && (e = e.replace(/\r\n/g, "\n")), e.indexOf("\\\n") !== -1 && (e = e.replace(/\\\n/g, ""));
|
|
176
|
-
let r = e.split("\n"), l = [];
|
|
177
|
-
for (let e = 0, n = r.length; e < n; e++) {
|
|
178
|
-
let n = r[e].trimStart();
|
|
179
|
-
if (n.length === 0) continue;
|
|
180
|
-
let i = n.charAt(0);
|
|
181
|
-
if (i !== "#") if (i === "v") {
|
|
182
|
-
let e = n.split(y);
|
|
183
|
-
switch (e[0]) {
|
|
184
|
-
case "v":
|
|
185
|
-
t.vertices.push(parseFloat(e[1]), parseFloat(e[2]), parseFloat(e[3])), e.length >= 7 ? (T.setRGB(parseFloat(e[4]), parseFloat(e[5]), parseFloat(e[6]), p), t.colors.push(T.r, T.g, T.b)) : t.colors.push(void 0, void 0, void 0);
|
|
186
|
-
break;
|
|
187
|
-
case "vn":
|
|
188
|
-
t.normals.push(parseFloat(e[1]), parseFloat(e[2]), parseFloat(e[3]));
|
|
189
|
-
break;
|
|
190
|
-
case "vt":
|
|
191
|
-
t.uvs.push(parseFloat(e[1]), parseFloat(e[2]));
|
|
192
|
-
break;
|
|
193
|
-
}
|
|
194
|
-
} else if (i === "f") {
|
|
195
|
-
let e = n.slice(1).trim().split(y), r = [];
|
|
196
|
-
for (let t = 0, n = e.length; t < n; t++) {
|
|
197
|
-
let n = e[t];
|
|
198
|
-
if (n.length > 0) {
|
|
199
|
-
let e = n.split("/");
|
|
200
|
-
r.push(e);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
let i = r[0];
|
|
204
|
-
for (let e = 1, n = r.length - 1; e < n; e++) {
|
|
205
|
-
let n = r[e], a = r[e + 1];
|
|
206
|
-
t.addFace(i[0], n[0], a[0], i[1], n[1], a[1], i[2], n[2], a[2]);
|
|
207
|
-
}
|
|
208
|
-
} else if (i === "l") {
|
|
209
|
-
let e = n.substring(1).trim().split(" "), r = [], i = [];
|
|
210
|
-
if (n.indexOf("/") === -1) r = e;
|
|
211
|
-
else for (let t = 0, n = e.length; t < n; t++) {
|
|
212
|
-
let n = e[t].split("/");
|
|
213
|
-
n[0] !== "" && r.push(n[0]), n[1] !== "" && i.push(n[1]);
|
|
214
|
-
}
|
|
215
|
-
t.addLineGeometry(r, i);
|
|
216
|
-
} else if (i === "p") {
|
|
217
|
-
let e = n.slice(1).trim().split(" ");
|
|
218
|
-
t.addPointGeometry(e);
|
|
219
|
-
} else if ((l = h.exec(n)) !== null) {
|
|
220
|
-
let e = (" " + l[0].slice(1).trim()).slice(1);
|
|
221
|
-
t.startObject(e);
|
|
222
|
-
} else if (_.test(n)) t.object.startMaterial(n.substring(7).trim(), t.materialLibraries);
|
|
223
|
-
else if (g.test(n)) t.materialLibraries.push(n.substring(7).trim());
|
|
224
|
-
else if (v.test(n)) console.warn("THREE.OBJLoader: Rendering identifier \"usemap\" not supported. Textures must be defined in MTL files.");
|
|
225
|
-
else if (i === "s") {
|
|
226
|
-
if (l = n.split(" "), l.length > 1) {
|
|
227
|
-
let e = l[1].trim().toLowerCase();
|
|
228
|
-
t.object.smooth = e !== "0" && e !== "off";
|
|
229
|
-
} else t.object.smooth = !0;
|
|
230
|
-
let e = t.object.currentMaterial();
|
|
231
|
-
e && (e.smooth = t.object.smooth);
|
|
232
|
-
} else {
|
|
233
|
-
if (n === "\0") continue;
|
|
234
|
-
console.warn("THREE.OBJLoader: Unexpected line: \"" + n + "\"");
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
t.finalize();
|
|
238
|
-
let b = new n();
|
|
239
|
-
if (b.materialLibraries = [].concat(t.materialLibraries), !(t.objects.length === 1 && t.objects[0].geometry.vertices.length === 0)) for (let e = 0, n = t.objects.length; e < n; e++) {
|
|
240
|
-
let n = t.objects[e], r = n.geometry, l = n.materials, p = r.type === "Line", h = r.type === "Points", g = !1;
|
|
241
|
-
if (r.vertices.length === 0) continue;
|
|
242
|
-
let _ = new d();
|
|
243
|
-
_.setAttribute("position", new f(r.vertices, 3)), r.normals.length > 0 && _.setAttribute("normal", new f(r.normals, 3)), r.colors.length > 0 && (g = !0, _.setAttribute("color", new f(r.colors, 3))), r.hasUVIndices === !0 && _.setAttribute("uv", new f(r.uvs, 2));
|
|
244
|
-
let v = [];
|
|
245
|
-
for (let e = 0, n = l.length; e < n; e++) {
|
|
246
|
-
let n = l[e], r = n.name + "_" + n.smooth + "_" + g, i = t.materials[r];
|
|
247
|
-
if (this.materials !== null) {
|
|
248
|
-
if (i = this.materials.create(n.name), p && i && !(i instanceof m)) {
|
|
249
|
-
let e = new m();
|
|
250
|
-
a.prototype.copy.call(e, i), e.color.copy(i.color), i = e;
|
|
251
|
-
} else if (h && i && !(i instanceof o)) {
|
|
252
|
-
let e = new o({
|
|
253
|
-
size: 10,
|
|
254
|
-
sizeAttenuation: !1
|
|
255
|
-
});
|
|
256
|
-
a.prototype.copy.call(e, i), e.color.copy(i.color), e.map = i.map, i = e;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
i === void 0 && (i = p ? new m() : h ? new o({
|
|
260
|
-
size: 1,
|
|
261
|
-
sizeAttenuation: !1
|
|
262
|
-
}) : new u(), i.name = n.name, i.flatShading = !n.smooth, i.vertexColors = g, t.materials[r] = i), v.push(i);
|
|
263
|
-
}
|
|
264
|
-
let y;
|
|
265
|
-
if (v.length > 1) {
|
|
266
|
-
for (let e = 0, t = l.length; e < t; e++) {
|
|
267
|
-
let t = l[e];
|
|
268
|
-
_.addGroup(t.groupStart, t.groupCount, e);
|
|
269
|
-
}
|
|
270
|
-
y = p ? new i(_, v) : h ? new c(_, v) : new s(_, v);
|
|
271
|
-
} else y = p ? new i(_, v[0]) : h ? new c(_, v[0]) : new s(_, v[0]);
|
|
272
|
-
y.name = n.name, b.add(y);
|
|
273
|
-
}
|
|
274
|
-
else if (t.vertices.length > 0) {
|
|
275
|
-
let e = new o({
|
|
276
|
-
size: 1,
|
|
277
|
-
sizeAttenuation: !1
|
|
278
|
-
}), n = new d();
|
|
279
|
-
n.setAttribute("position", new f(t.vertices, 3)), t.colors.length > 0 && t.colors[0] !== void 0 && (n.setAttribute("color", new f(t.colors, 3)), e.vertexColors = !0);
|
|
280
|
-
let r = new c(n, e);
|
|
281
|
-
b.add(r);
|
|
282
|
-
}
|
|
283
|
-
return b;
|
|
284
|
-
}
|
|
285
|
-
};
|
|
286
|
-
//#endregion
|
|
287
|
-
export { D as OBJLoader };
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { n as e, t } from "./asyncToGenerator.js";
|
|
2
|
-
import { n, r, t as i } from "./viewerZoom.js";
|
|
3
|
-
import { t as a } from "./_plugin-vue_export-helper.js";
|
|
4
|
-
import { createCommentVNode as o, createElementBlock as s, createElementVNode as c, defineComponent as l, nextTick as u, onBeforeUnmount as d, onMounted as f, openBlock as p, ref as m, toDisplayString as h } from "vue";
|
|
5
|
-
//#region src/package/vendors/ofd/OfdViewer.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
-
e();
|
|
7
|
-
var g = {
|
|
8
|
-
key: 0,
|
|
9
|
-
class: "ofd-state"
|
|
10
|
-
}, _ = {
|
|
11
|
-
key: 1,
|
|
12
|
-
class: "ofd-state error"
|
|
13
|
-
}, v = /*#__PURE__*/ a(/* @__PURE__ */ l({
|
|
14
|
-
__name: "OfdViewer",
|
|
15
|
-
props: { data: {} },
|
|
16
|
-
setup(e) {
|
|
17
|
-
let a = e, l = m(null), v = m(null), y = m("loading"), b = m(""), x = m(1), S = i(), C = !1, w = 0, T = null, E = 0, D = 0, O = null, k = () => {
|
|
18
|
-
let e = l.value;
|
|
19
|
-
if (e) for (; e.firstChild;) e.removeChild(e.firstChild);
|
|
20
|
-
}, A = (e) => new Promise((t, n) => {
|
|
21
|
-
e.parseOfdDocument({
|
|
22
|
-
ofd: a.data,
|
|
23
|
-
success: (e) => t(e),
|
|
24
|
-
fail: (e) => n(e)
|
|
25
|
-
});
|
|
26
|
-
}), j = function() {
|
|
27
|
-
var e = t(function* (e) {
|
|
28
|
-
return O || (O = A(e).then((e) => {
|
|
29
|
-
let t = e[0];
|
|
30
|
-
if (!t) throw Error("OFD 文件中没有可渲染的文档");
|
|
31
|
-
return t;
|
|
32
|
-
})), O;
|
|
33
|
-
});
|
|
34
|
-
return function(t) {
|
|
35
|
-
return e.apply(this, arguments);
|
|
36
|
-
};
|
|
37
|
-
}(), M = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : JSON.stringify(e), N = (e, t) => {
|
|
38
|
-
let n = document.createDocumentFragment();
|
|
39
|
-
t.forEach((e) => {
|
|
40
|
-
let t = document.createElement("div");
|
|
41
|
-
t.className = "ofd-page-frame", e.classList.add("ofd-page"), t.appendChild(e), n.appendChild(t);
|
|
42
|
-
}), e.appendChild(n);
|
|
43
|
-
}, P = () => {
|
|
44
|
-
var e, t;
|
|
45
|
-
let n = ((e = v.value) == null ? void 0 : e.getBoundingClientRect().width) || ((t = l.value) == null ? void 0 : t.getBoundingClientRect().width) || 0;
|
|
46
|
-
return Math.max(Math.floor(n - 48), 240);
|
|
47
|
-
}, F = (e) => Math.min(3, Math.max(.35, Number(e.toFixed(2)))), I = () => ({
|
|
48
|
-
scale: x.value,
|
|
49
|
-
label: `${Math.round(x.value * 100)}%`,
|
|
50
|
-
canZoomIn: x.value < 3,
|
|
51
|
-
canZoomOut: x.value > .35,
|
|
52
|
-
canReset: x.value !== 1,
|
|
53
|
-
minScale: .35,
|
|
54
|
-
maxScale: 3
|
|
55
|
-
}), L = (e) => (x.value = F(e), R(), S.emit(), I()), R = () => {
|
|
56
|
-
let e = l.value;
|
|
57
|
-
e && e.querySelectorAll(".ofd-page-frame").forEach((e) => {
|
|
58
|
-
let t = e.firstElementChild;
|
|
59
|
-
if (!(t instanceof HTMLElement)) return;
|
|
60
|
-
t.style.position = "absolute", t.style.top = "0", t.style.left = "50%", t.style.transform = `translateX(-50%) scale(${x.value})`, t.style.transformOrigin = "top center", t.style.marginLeft = "0", t.style.marginRight = "0";
|
|
61
|
-
let n = t.offsetWidth, r = t.offsetHeight;
|
|
62
|
-
!n || !r || (e.style.width = `${Math.ceil(n * x.value)}px`, e.style.height = `${Math.ceil(r * x.value)}px`);
|
|
63
|
-
});
|
|
64
|
-
}, z = () => {
|
|
65
|
-
let e = v.value;
|
|
66
|
-
e && n(e, {
|
|
67
|
-
zoomIn: () => L(x.value + .1),
|
|
68
|
-
zoomOut: () => L(x.value - .1),
|
|
69
|
-
resetZoom: () => L(1),
|
|
70
|
-
setZoom: L,
|
|
71
|
-
getState: I,
|
|
72
|
-
subscribe: S.subscribe
|
|
73
|
-
});
|
|
74
|
-
}, B = function() {
|
|
75
|
-
var e = t(function* (e) {
|
|
76
|
-
let t = yield import("./ofd.js"), n = yield j(t);
|
|
77
|
-
return C ? [] : Promise.resolve(t.renderOfd(e, n));
|
|
78
|
-
});
|
|
79
|
-
return function(t) {
|
|
80
|
-
return e.apply(this, arguments);
|
|
81
|
-
};
|
|
82
|
-
}(), V = function() {
|
|
83
|
-
var e = t(function* (e = {}) {
|
|
84
|
-
var t, n;
|
|
85
|
-
let r = l.value;
|
|
86
|
-
if (!r) return;
|
|
87
|
-
let i = (t = e.force) == null ? !1 : t, a = (n = e.showLoading) == null ? !1 : n, o = P();
|
|
88
|
-
if (!i && y.value === "ready" && Math.abs(o - D) < 8) return;
|
|
89
|
-
let s = ++w;
|
|
90
|
-
(a || y.value !== "ready") && (y.value = "loading", k()), b.value = "";
|
|
91
|
-
try {
|
|
92
|
-
yield u();
|
|
93
|
-
let e = yield B(o);
|
|
94
|
-
if (C || s !== w) return;
|
|
95
|
-
k(), N(r, e), D = o, yield u(), R(), y.value = "ready", S.emit();
|
|
96
|
-
} catch (e) {
|
|
97
|
-
if (C || s !== w) return;
|
|
98
|
-
console.error(e), y.value = "error", b.value = M(e) || "OFD 文件解析失败";
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
return function() {
|
|
102
|
-
return e.apply(this, arguments);
|
|
103
|
-
};
|
|
104
|
-
}(), H = () => {
|
|
105
|
-
!v.value || T || (T = new ResizeObserver(() => {
|
|
106
|
-
window.clearTimeout(E), E = window.setTimeout(() => {
|
|
107
|
-
C || V({ showLoading: !1 });
|
|
108
|
-
}, 180);
|
|
109
|
-
}), T.observe(v.value));
|
|
110
|
-
};
|
|
111
|
-
return f(() => {
|
|
112
|
-
z(), V({
|
|
113
|
-
force: !0,
|
|
114
|
-
showLoading: !0
|
|
115
|
-
}).finally(() => {
|
|
116
|
-
H();
|
|
117
|
-
});
|
|
118
|
-
}), d(() => {
|
|
119
|
-
C = !0, w += 1, window.clearTimeout(E), T == null || T.disconnect(), T = null, r(v.value), k();
|
|
120
|
-
}), (e, t) => (p(), s("div", {
|
|
121
|
-
ref_key: "viewer",
|
|
122
|
-
ref: v,
|
|
123
|
-
class: "ofd-viewer",
|
|
124
|
-
"data-viewer-zoom-provider": "ofd"
|
|
125
|
-
}, [y.value === "loading" ? (p(), s("div", g, "正在解析 OFD...")) : y.value === "error" ? (p(), s("div", _, h(b.value), 1)) : o("", !0), c("div", {
|
|
126
|
-
ref_key: "stage",
|
|
127
|
-
ref: l,
|
|
128
|
-
class: "ofd-stage"
|
|
129
|
-
}, null, 512)], 512));
|
|
130
|
-
}
|
|
131
|
-
}), [["__scopeId", "data-v-225f4bc3"]]);
|
|
132
|
-
//#endregion
|
|
133
|
-
export { v as default };
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { C as e, K as t, _t as n, gt as r, j as i, p as a, u as o, w as s, wt as c } from "./three.module.js";
|
|
2
|
-
//#region node_modules/.pnpm/three@0.184.0/node_modules/three/examples/jsm/loaders/PCDLoader.js
|
|
3
|
-
var l = class extends t {
|
|
4
|
-
constructor(e) {
|
|
5
|
-
super(e), this.littleEndian = !0;
|
|
6
|
-
}
|
|
7
|
-
load(t, n, r, i) {
|
|
8
|
-
let a = this, o = new e(a.manager);
|
|
9
|
-
o.setPath(a.path), o.setResponseType("arraybuffer"), o.setRequestHeader(a.requestHeader), o.setWithCredentials(a.withCredentials), o.load(t, function(e) {
|
|
10
|
-
try {
|
|
11
|
-
n(a.parse(e));
|
|
12
|
-
} catch (e) {
|
|
13
|
-
i ? i(e) : console.error(e), a.manager.itemError(t);
|
|
14
|
-
}
|
|
15
|
-
}, r, i);
|
|
16
|
-
}
|
|
17
|
-
_getDataView(e, t, n, r) {
|
|
18
|
-
switch (n) {
|
|
19
|
-
case "F": return r === 8 ? e.getFloat64(t, this.littleEndian) : e.getFloat32(t, this.littleEndian);
|
|
20
|
-
case "I": return r === 1 ? e.getInt8(t) : r === 2 ? e.getInt16(t, this.littleEndian) : e.getInt32(t, this.littleEndian);
|
|
21
|
-
case "U": return r === 1 ? e.getUint8(t) : r === 2 ? e.getUint16(t, this.littleEndian) : e.getUint32(t, this.littleEndian);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
parse(e) {
|
|
25
|
-
function t(e, t) {
|
|
26
|
-
let n = e.length, r = new Uint8Array(t), i = 0, a = 0, o, s, c;
|
|
27
|
-
do
|
|
28
|
-
if (o = e[i++], o < 32) {
|
|
29
|
-
if (o++, a + o > t) throw Error("Output buffer is not large enough");
|
|
30
|
-
if (i + o > n) throw Error("Invalid compressed data");
|
|
31
|
-
do
|
|
32
|
-
r[a++] = e[i++];
|
|
33
|
-
while (--o);
|
|
34
|
-
} else {
|
|
35
|
-
if (s = o >> 5, c = a - ((o & 31) << 8) - 1, i >= n || s === 7 && (s += e[i++], i >= n)) throw Error("Invalid compressed data");
|
|
36
|
-
if (c -= e[i++], a + s + 2 > t) throw Error("Output buffer is not large enough");
|
|
37
|
-
if (c < 0 || c >= a) throw Error("Invalid compressed data");
|
|
38
|
-
do
|
|
39
|
-
r[a++] = r[c++];
|
|
40
|
-
while (--s + 2);
|
|
41
|
-
}
|
|
42
|
-
while (i < n);
|
|
43
|
-
return r;
|
|
44
|
-
}
|
|
45
|
-
function l(e) {
|
|
46
|
-
let t = {}, n = new Uint8Array(e), r = "", i = "", a = 0, o = !1, s = n.length;
|
|
47
|
-
for (; a < s && o === !1;) {
|
|
48
|
-
let e = String.fromCharCode(n[a++]);
|
|
49
|
-
e === "\n" || e === "\r" ? (i.trim().toLowerCase().startsWith("data") && (o = !0), i = "") : i += e, r += e;
|
|
50
|
-
}
|
|
51
|
-
let c = r.search(/[\r\n]DATA\s(\S*)\s/i), l = /[\r\n]DATA\s(\S*)\s/i.exec(r.slice(c - 1));
|
|
52
|
-
if (t.data = l[1], t.headerLen = l[0].length + c, t.str = r.slice(0, t.headerLen), t.str = t.str.replace(/#.*/gi, ""), t.version = /^VERSION (.*)/im.exec(t.str), t.fields = /^FIELDS (.*)/im.exec(t.str), t.size = /^SIZE (.*)/im.exec(t.str), t.type = /^TYPE (.*)/im.exec(t.str), t.count = /^COUNT (.*)/im.exec(t.str), t.width = /^WIDTH (.*)/im.exec(t.str), t.height = /^HEIGHT (.*)/im.exec(t.str), t.viewpoint = /^VIEWPOINT (.*)/im.exec(t.str), t.points = /^POINTS (.*)/im.exec(t.str), t.version !== null && (t.version = parseFloat(t.version[1])), t.fields = t.fields === null ? [] : t.fields[1].split(" "), t.type !== null && (t.type = t.type[1].split(" ")), t.width !== null && (t.width = parseInt(t.width[1])), t.height !== null && (t.height = parseInt(t.height[1])), t.viewpoint !== null && (t.viewpoint = t.viewpoint[1]), t.points !== null && (t.points = parseInt(t.points[1], 10)), t.points === null && (t.points = t.width * t.height), t.size !== null && (t.size = t.size[1].split(" ").map(function(e) {
|
|
53
|
-
return parseInt(e, 10);
|
|
54
|
-
})), t.count !== null) t.count = t.count[1].split(" ").map(function(e) {
|
|
55
|
-
return parseInt(e, 10);
|
|
56
|
-
});
|
|
57
|
-
else {
|
|
58
|
-
t.count = [];
|
|
59
|
-
for (let e = 0, n = t.fields.length; e < n; e++) t.count.push(1);
|
|
60
|
-
}
|
|
61
|
-
t.offset = {};
|
|
62
|
-
let u = 0;
|
|
63
|
-
for (let e = 0, n = t.fields.length; e < n; e++) t.data === "ascii" ? t.offset[t.fields[e]] = e : (t.offset[t.fields[e]] = u, u += t.size[e] * t.count[e]);
|
|
64
|
-
return t.rowSize = u, t;
|
|
65
|
-
}
|
|
66
|
-
let u = l(e), d = [], f = [], p = [], m = [], h = [], g = new a();
|
|
67
|
-
if (u.data === "ascii") {
|
|
68
|
-
let t = u.offset, n = new TextDecoder().decode(e).slice(u.headerLen).split("\n");
|
|
69
|
-
for (let e = 0, r = n.length; e < r; e++) {
|
|
70
|
-
if (n[e] === "") continue;
|
|
71
|
-
let r = n[e].split(" ");
|
|
72
|
-
if (t.x !== void 0 && (d.push(parseFloat(r[t.x])), d.push(parseFloat(r[t.y])), d.push(parseFloat(r[t.z]))), t.rgb !== void 0) {
|
|
73
|
-
let e = u.fields.findIndex((e) => e === "rgb"), n = u.type[e], i = parseFloat(r[t.rgb]), a = i;
|
|
74
|
-
if (n === "F") {
|
|
75
|
-
let e = new Float32Array(1);
|
|
76
|
-
e[0] = i, a = new Int32Array(e.buffer)[0];
|
|
77
|
-
}
|
|
78
|
-
let o = (a >> 16 & 255) / 255, s = (a >> 8 & 255) / 255, l = (a >> 0 & 255) / 255;
|
|
79
|
-
g.setRGB(o, s, l, c), p.push(g.r, g.g, g.b);
|
|
80
|
-
}
|
|
81
|
-
t.normal_x !== void 0 && (f.push(parseFloat(r[t.normal_x])), f.push(parseFloat(r[t.normal_y])), f.push(parseFloat(r[t.normal_z]))), t.intensity !== void 0 && m.push(parseFloat(r[t.intensity])), t.label !== void 0 && h.push(parseInt(r[t.label]));
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
if (u.data === "binary_compressed") {
|
|
85
|
-
let n = new Uint32Array(e.slice(u.headerLen, u.headerLen + 8)), r = n[0], i = n[1], a = t(new Uint8Array(e, u.headerLen + 8, r), i), o = new DataView(a.buffer), s = u.offset;
|
|
86
|
-
for (let e = 0; e < u.points; e++) {
|
|
87
|
-
if (s.x !== void 0) {
|
|
88
|
-
let t = u.fields.indexOf("x"), n = u.fields.indexOf("y"), r = u.fields.indexOf("z");
|
|
89
|
-
d.push(this._getDataView(o, u.points * s.x + u.size[t] * e, u.type[t], u.size[t])), d.push(this._getDataView(o, u.points * s.y + u.size[n] * e, u.type[n], u.size[n])), d.push(this._getDataView(o, u.points * s.z + u.size[r] * e, u.type[r], u.size[r]));
|
|
90
|
-
}
|
|
91
|
-
if (s.rgb !== void 0) {
|
|
92
|
-
let t = u.fields.indexOf("rgb"), n = o.getUint8(u.points * s.rgb + u.size[t] * e + 2) / 255, r = o.getUint8(u.points * s.rgb + u.size[t] * e + 1) / 255, i = o.getUint8(u.points * s.rgb + u.size[t] * e + 0) / 255;
|
|
93
|
-
g.setRGB(n, r, i, c), p.push(g.r, g.g, g.b);
|
|
94
|
-
}
|
|
95
|
-
if (s.normal_x !== void 0) {
|
|
96
|
-
let t = u.fields.indexOf("normal_x"), n = u.fields.indexOf("normal_y"), r = u.fields.indexOf("normal_z");
|
|
97
|
-
f.push(this._getDataView(o, u.points * s.normal_x + u.size[t] * e, u.type[t], u.size[t])), f.push(this._getDataView(o, u.points * s.normal_y + u.size[n] * e, u.type[n], u.size[n])), f.push(this._getDataView(o, u.points * s.normal_z + u.size[r] * e, u.type[r], u.size[r]));
|
|
98
|
-
}
|
|
99
|
-
if (s.intensity !== void 0) {
|
|
100
|
-
let t = u.fields.indexOf("intensity");
|
|
101
|
-
m.push(this._getDataView(o, u.points * s.intensity + u.size[t] * e, u.type[t], u.size[t]));
|
|
102
|
-
}
|
|
103
|
-
if (s.label !== void 0) {
|
|
104
|
-
let t = u.fields.indexOf("label");
|
|
105
|
-
h.push(this._getDataView(o, u.points * s.label + u.size[t] * e, u.type[t], u.size[t]));
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
if (u.data === "binary") {
|
|
110
|
-
let t = new DataView(e, u.headerLen), n = u.offset;
|
|
111
|
-
for (let e = 0, r = 0; e < u.points; e++, r += u.rowSize) {
|
|
112
|
-
if (n.x !== void 0) {
|
|
113
|
-
let e = u.fields.indexOf("x"), i = u.fields.indexOf("y"), a = u.fields.indexOf("z");
|
|
114
|
-
d.push(this._getDataView(t, r + n.x, u.type[e], u.size[e])), d.push(this._getDataView(t, r + n.y, u.type[i], u.size[i])), d.push(this._getDataView(t, r + n.z, u.type[a], u.size[a]));
|
|
115
|
-
}
|
|
116
|
-
if (n.rgb !== void 0) {
|
|
117
|
-
let e = t.getUint8(r + n.rgb + 2) / 255, i = t.getUint8(r + n.rgb + 1) / 255, a = t.getUint8(r + n.rgb + 0) / 255;
|
|
118
|
-
g.setRGB(e, i, a, c), p.push(g.r, g.g, g.b);
|
|
119
|
-
}
|
|
120
|
-
if (n.normal_x !== void 0) {
|
|
121
|
-
let e = u.fields.indexOf("normal_x"), i = u.fields.indexOf("normal_y"), a = u.fields.indexOf("normal_z");
|
|
122
|
-
f.push(this._getDataView(t, r + n.normal_x, u.type[e], u.size[e])), f.push(this._getDataView(t, r + n.normal_y, u.type[i], u.size[i])), f.push(this._getDataView(t, r + n.normal_z, u.type[a], u.size[a]));
|
|
123
|
-
}
|
|
124
|
-
if (n.intensity !== void 0) {
|
|
125
|
-
let e = u.fields.indexOf("intensity");
|
|
126
|
-
m.push(this._getDataView(t, r + n.intensity, u.type[e], u.size[e]));
|
|
127
|
-
}
|
|
128
|
-
if (n.label !== void 0) {
|
|
129
|
-
let e = u.fields.indexOf("label");
|
|
130
|
-
h.push(this._getDataView(t, r + n.label, u.type[e], u.size[e]));
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
let _ = new o();
|
|
135
|
-
d.length > 0 && _.setAttribute("position", new s(d, 3)), f.length > 0 && _.setAttribute("normal", new s(f, 3)), p.length > 0 && _.setAttribute("color", new s(p, 3)), m.length > 0 && _.setAttribute("intensity", new s(m, 1)), h.length > 0 && _.setAttribute("label", new i(h, 1)), _.computeBoundingSphere();
|
|
136
|
-
let v = new n({ size: .005 });
|
|
137
|
-
return p.length > 0 && (v.vertexColors = !0), new r(_, v);
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
//#endregion
|
|
141
|
-
export { l as PCDLoader };
|