@flyfish-group/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 +3 -388
- package/README.md +3 -364
- package/dist/file-viewer3.css +1 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/package.json +22 -126
- 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,797 +0,0 @@
|
|
|
1
|
-
import { n as e, t } from "./asyncToGenerator.js";
|
|
2
|
-
import { t as n } from "./_plugin-vue_export-helper.js";
|
|
3
|
-
import { Bt as r, D as i, It as a, Nt as o, T as ee, Tt as te, Y as s, Z as c, _t as ne, a as re, at as ie, et as l, g as u, gt as ae, i as d, jt as f, mt as p, p as oe, pt as se, s as m, t as ce, wt as le, x as h, xt as g, yt as _, zt as v } from "./three.module.js";
|
|
4
|
-
import { createCommentVNode as ue, createElementBlock as y, createElementVNode as b, defineComponent as x, nextTick as de, normalizeClass as S, onBeforeUnmount as fe, onMounted as pe, openBlock as C, ref as w, toDisplayString as T, watch as me } from "vue";
|
|
5
|
-
//#region node_modules/.pnpm/three@0.184.0/node_modules/three/examples/jsm/controls/OrbitControls.js
|
|
6
|
-
e();
|
|
7
|
-
var E = { type: "change" }, D = { type: "start" }, O = { type: "end" }, k = new g(), A = new p(), j = Math.cos(70 * c.DEG2RAD), M = new r(), N = 2 * Math.PI, P = {
|
|
8
|
-
NONE: -1,
|
|
9
|
-
ROTATE: 0,
|
|
10
|
-
DOLLY: 1,
|
|
11
|
-
PAN: 2,
|
|
12
|
-
TOUCH_ROTATE: 3,
|
|
13
|
-
TOUCH_PAN: 4,
|
|
14
|
-
TOUCH_DOLLY_PAN: 5,
|
|
15
|
-
TOUCH_DOLLY_ROTATE: 6
|
|
16
|
-
}, F = 1e-6, he = class extends u {
|
|
17
|
-
constructor(e, t = null) {
|
|
18
|
-
super(e, t), this.state = P.NONE, this.target = new r(), this.cursor = new r(), this.minDistance = 0, this.maxDistance = Infinity, this.minZoom = 0, this.maxZoom = Infinity, this.minTargetRadius = 0, this.maxTargetRadius = Infinity, this.minPolarAngle = 0, this.maxPolarAngle = Math.PI, this.minAzimuthAngle = -Infinity, this.maxAzimuthAngle = Infinity, this.enableDamping = !1, this.dampingFactor = .05, this.enableZoom = !0, this.zoomSpeed = 1, this.enableRotate = !0, this.rotateSpeed = 1, this.keyRotateSpeed = 1, this.enablePan = !0, this.panSpeed = 1, this.screenSpacePanning = !0, this.keyPanSpeed = 7, this.zoomToCursor = !1, this.autoRotate = !1, this.autoRotateSpeed = 2, this.keys = {
|
|
19
|
-
LEFT: "ArrowLeft",
|
|
20
|
-
UP: "ArrowUp",
|
|
21
|
-
RIGHT: "ArrowRight",
|
|
22
|
-
BOTTOM: "ArrowDown"
|
|
23
|
-
}, this.mouseButtons = {
|
|
24
|
-
LEFT: s.ROTATE,
|
|
25
|
-
MIDDLE: s.DOLLY,
|
|
26
|
-
RIGHT: s.PAN
|
|
27
|
-
}, this.touches = {
|
|
28
|
-
ONE: o.ROTATE,
|
|
29
|
-
TWO: o.DOLLY_PAN
|
|
30
|
-
}, this.target0 = this.target.clone(), this.position0 = this.object.position.clone(), this.zoom0 = this.object.zoom, this._cursorStyle = "auto", this._domElementKeyEvents = null, this._lastPosition = new r(), this._lastQuaternion = new _(), this._lastTargetPosition = new r(), this._quat = new _().setFromUnitVectors(e.up, new r(0, 1, 0)), this._quatInverse = this._quat.clone().invert(), this._spherical = new f(), this._sphericalDelta = new f(), this._scale = 1, this._panOffset = new r(), this._rotateStart = new v(), this._rotateEnd = new v(), this._rotateDelta = new v(), this._panStart = new v(), this._panEnd = new v(), this._panDelta = new v(), this._dollyStart = new v(), this._dollyEnd = new v(), this._dollyDelta = new v(), this._dollyDirection = new r(), this._mouse = new v(), this._performCursorZoom = !1, this._pointers = [], this._pointerPositions = {}, this._controlActive = !1, this._onPointerMove = L.bind(this), this._onPointerDown = I.bind(this), this._onPointerUp = R.bind(this), this._onContextMenu = G.bind(this), this._onMouseWheel = V.bind(this), this._onKeyDown = H.bind(this), this._onTouchStart = U.bind(this), this._onTouchMove = W.bind(this), this._onMouseDown = z.bind(this), this._onMouseMove = B.bind(this), this._interceptControlDown = K.bind(this), this._interceptControlUp = q.bind(this), this.domElement !== null && this.connect(this.domElement), this.update();
|
|
31
|
-
}
|
|
32
|
-
set cursorStyle(e) {
|
|
33
|
-
this._cursorStyle = e, e === "grab" ? this.domElement.style.cursor = "grab" : this.domElement.style.cursor = "auto";
|
|
34
|
-
}
|
|
35
|
-
get cursorStyle() {
|
|
36
|
-
return this._cursorStyle;
|
|
37
|
-
}
|
|
38
|
-
connect(e) {
|
|
39
|
-
super.connect(e), this.domElement.addEventListener("pointerdown", this._onPointerDown), this.domElement.addEventListener("pointercancel", this._onPointerUp), this.domElement.addEventListener("contextmenu", this._onContextMenu), this.domElement.addEventListener("wheel", this._onMouseWheel, { passive: !1 }), this.domElement.getRootNode().addEventListener("keydown", this._interceptControlDown, {
|
|
40
|
-
passive: !0,
|
|
41
|
-
capture: !0
|
|
42
|
-
}), this.domElement.style.touchAction = "none";
|
|
43
|
-
}
|
|
44
|
-
disconnect() {
|
|
45
|
-
this.domElement.removeEventListener("pointerdown", this._onPointerDown), this.domElement.ownerDocument.removeEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.removeEventListener("pointerup", this._onPointerUp), this.domElement.removeEventListener("pointercancel", this._onPointerUp), this.domElement.removeEventListener("wheel", this._onMouseWheel), this.domElement.removeEventListener("contextmenu", this._onContextMenu), this.stopListenToKeyEvents(), this.domElement.getRootNode().removeEventListener("keydown", this._interceptControlDown, { capture: !0 }), this.domElement.style.touchAction = "";
|
|
46
|
-
}
|
|
47
|
-
dispose() {
|
|
48
|
-
this.disconnect();
|
|
49
|
-
}
|
|
50
|
-
getPolarAngle() {
|
|
51
|
-
return this._spherical.phi;
|
|
52
|
-
}
|
|
53
|
-
getAzimuthalAngle() {
|
|
54
|
-
return this._spherical.theta;
|
|
55
|
-
}
|
|
56
|
-
getDistance() {
|
|
57
|
-
return this.object.position.distanceTo(this.target);
|
|
58
|
-
}
|
|
59
|
-
listenToKeyEvents(e) {
|
|
60
|
-
e.addEventListener("keydown", this._onKeyDown), this._domElementKeyEvents = e;
|
|
61
|
-
}
|
|
62
|
-
stopListenToKeyEvents() {
|
|
63
|
-
this._domElementKeyEvents !== null && (this._domElementKeyEvents.removeEventListener("keydown", this._onKeyDown), this._domElementKeyEvents = null);
|
|
64
|
-
}
|
|
65
|
-
saveState() {
|
|
66
|
-
this.target0.copy(this.target), this.position0.copy(this.object.position), this.zoom0 = this.object.zoom;
|
|
67
|
-
}
|
|
68
|
-
reset() {
|
|
69
|
-
this.target.copy(this.target0), this.object.position.copy(this.position0), this.object.zoom = this.zoom0, this.object.updateProjectionMatrix(), this.dispatchEvent(E), this.update(), this.state = P.NONE;
|
|
70
|
-
}
|
|
71
|
-
pan(e, t) {
|
|
72
|
-
this._pan(e, t), this.update();
|
|
73
|
-
}
|
|
74
|
-
dollyIn(e) {
|
|
75
|
-
this._dollyIn(e), this.update();
|
|
76
|
-
}
|
|
77
|
-
dollyOut(e) {
|
|
78
|
-
this._dollyOut(e), this.update();
|
|
79
|
-
}
|
|
80
|
-
rotateLeft(e) {
|
|
81
|
-
this._rotateLeft(e), this.update();
|
|
82
|
-
}
|
|
83
|
-
rotateUp(e) {
|
|
84
|
-
this._rotateUp(e), this.update();
|
|
85
|
-
}
|
|
86
|
-
update(e = null) {
|
|
87
|
-
let t = this.object.position;
|
|
88
|
-
M.copy(t).sub(this.target), M.applyQuaternion(this._quat), this._spherical.setFromVector3(M), this.autoRotate && this.state === P.NONE && this._rotateLeft(this._getAutoRotationAngle(e)), this.enableDamping ? (this._spherical.theta += this._sphericalDelta.theta * this.dampingFactor, this._spherical.phi += this._sphericalDelta.phi * this.dampingFactor) : (this._spherical.theta += this._sphericalDelta.theta, this._spherical.phi += this._sphericalDelta.phi);
|
|
89
|
-
let n = this.minAzimuthAngle, i = this.maxAzimuthAngle;
|
|
90
|
-
isFinite(n) && isFinite(i) && (n < -Math.PI ? n += N : n > Math.PI && (n -= N), i < -Math.PI ? i += N : i > Math.PI && (i -= N), n <= i ? this._spherical.theta = Math.max(n, Math.min(i, this._spherical.theta)) : this._spherical.theta = this._spherical.theta > (n + i) / 2 ? Math.max(n, this._spherical.theta) : Math.min(i, this._spherical.theta)), this._spherical.phi = Math.max(this.minPolarAngle, Math.min(this.maxPolarAngle, this._spherical.phi)), this._spherical.makeSafe(), this.enableDamping === !0 ? this.target.addScaledVector(this._panOffset, this.dampingFactor) : this.target.add(this._panOffset), this.target.sub(this.cursor), this.target.clampLength(this.minTargetRadius, this.maxTargetRadius), this.target.add(this.cursor);
|
|
91
|
-
let a = !1;
|
|
92
|
-
if (this.zoomToCursor && this._performCursorZoom || this.object.isOrthographicCamera) this._spherical.radius = this._clampDistance(this._spherical.radius);
|
|
93
|
-
else {
|
|
94
|
-
let e = this._spherical.radius;
|
|
95
|
-
this._spherical.radius = this._clampDistance(this._spherical.radius * this._scale), a = e != this._spherical.radius;
|
|
96
|
-
}
|
|
97
|
-
if (M.setFromSpherical(this._spherical), M.applyQuaternion(this._quatInverse), t.copy(this.target).add(M), this.object.lookAt(this.target), this.enableDamping === !0 ? (this._sphericalDelta.theta *= 1 - this.dampingFactor, this._sphericalDelta.phi *= 1 - this.dampingFactor, this._panOffset.multiplyScalar(1 - this.dampingFactor)) : (this._sphericalDelta.set(0, 0, 0), this._panOffset.set(0, 0, 0)), this.zoomToCursor && this._performCursorZoom) {
|
|
98
|
-
let e = null;
|
|
99
|
-
if (this.object.isPerspectiveCamera) {
|
|
100
|
-
let t = M.length();
|
|
101
|
-
e = this._clampDistance(t * this._scale);
|
|
102
|
-
let n = t - e;
|
|
103
|
-
this.object.position.addScaledVector(this._dollyDirection, n), this.object.updateMatrixWorld(), a = !!n;
|
|
104
|
-
} else if (this.object.isOrthographicCamera) {
|
|
105
|
-
let t = new r(this._mouse.x, this._mouse.y, 0);
|
|
106
|
-
t.unproject(this.object);
|
|
107
|
-
let n = this.object.zoom;
|
|
108
|
-
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), this.object.updateProjectionMatrix(), a = n !== this.object.zoom;
|
|
109
|
-
let i = new r(this._mouse.x, this._mouse.y, 0);
|
|
110
|
-
i.unproject(this.object), this.object.position.sub(i).add(t), this.object.updateMatrixWorld(), e = M.length();
|
|
111
|
-
} else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."), this.zoomToCursor = !1;
|
|
112
|
-
e !== null && (this.screenSpacePanning ? this.target.set(0, 0, -1).transformDirection(this.object.matrix).multiplyScalar(e).add(this.object.position) : (k.origin.copy(this.object.position), k.direction.set(0, 0, -1).transformDirection(this.object.matrix), Math.abs(this.object.up.dot(k.direction)) < j ? this.object.lookAt(this.target) : (A.setFromNormalAndCoplanarPoint(this.object.up, this.target), k.intersectPlane(A, this.target))));
|
|
113
|
-
} else if (this.object.isOrthographicCamera) {
|
|
114
|
-
let e = this.object.zoom;
|
|
115
|
-
this.object.zoom = Math.max(this.minZoom, Math.min(this.maxZoom, this.object.zoom / this._scale)), e !== this.object.zoom && (this.object.updateProjectionMatrix(), a = !0);
|
|
116
|
-
}
|
|
117
|
-
return this._scale = 1, this._performCursorZoom = !1, a || this._lastPosition.distanceToSquared(this.object.position) > F || 8 * (1 - this._lastQuaternion.dot(this.object.quaternion)) > F || this._lastTargetPosition.distanceToSquared(this.target) > F ? (this.dispatchEvent(E), this._lastPosition.copy(this.object.position), this._lastQuaternion.copy(this.object.quaternion), this._lastTargetPosition.copy(this.target), !0) : !1;
|
|
118
|
-
}
|
|
119
|
-
_getAutoRotationAngle(e) {
|
|
120
|
-
return e === null ? N / 60 / 60 * this.autoRotateSpeed : N / 60 * this.autoRotateSpeed * e;
|
|
121
|
-
}
|
|
122
|
-
_getZoomScale(e) {
|
|
123
|
-
let t = Math.abs(e * .01);
|
|
124
|
-
return Math.pow(.95, this.zoomSpeed * t);
|
|
125
|
-
}
|
|
126
|
-
_rotateLeft(e) {
|
|
127
|
-
this._sphericalDelta.theta -= e;
|
|
128
|
-
}
|
|
129
|
-
_rotateUp(e) {
|
|
130
|
-
this._sphericalDelta.phi -= e;
|
|
131
|
-
}
|
|
132
|
-
_panLeft(e, t) {
|
|
133
|
-
M.setFromMatrixColumn(t, 0), M.multiplyScalar(-e), this._panOffset.add(M);
|
|
134
|
-
}
|
|
135
|
-
_panUp(e, t) {
|
|
136
|
-
this.screenSpacePanning === !0 ? M.setFromMatrixColumn(t, 1) : (M.setFromMatrixColumn(t, 0), M.crossVectors(this.object.up, M)), M.multiplyScalar(e), this._panOffset.add(M);
|
|
137
|
-
}
|
|
138
|
-
_pan(e, t) {
|
|
139
|
-
let n = this.domElement;
|
|
140
|
-
if (this.object.isPerspectiveCamera) {
|
|
141
|
-
let r = this.object.position;
|
|
142
|
-
M.copy(r).sub(this.target);
|
|
143
|
-
let i = M.length();
|
|
144
|
-
i *= Math.tan(this.object.fov / 2 * Math.PI / 180), this._panLeft(2 * e * i / n.clientHeight, this.object.matrix), this._panUp(2 * t * i / n.clientHeight, this.object.matrix);
|
|
145
|
-
} else this.object.isOrthographicCamera ? (this._panLeft(e * (this.object.right - this.object.left) / this.object.zoom / n.clientWidth, this.object.matrix), this._panUp(t * (this.object.top - this.object.bottom) / this.object.zoom / n.clientHeight, this.object.matrix)) : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."), this.enablePan = !1);
|
|
146
|
-
}
|
|
147
|
-
_dollyOut(e) {
|
|
148
|
-
this.object.isPerspectiveCamera || this.object.isOrthographicCamera ? this._scale /= e : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), this.enableZoom = !1);
|
|
149
|
-
}
|
|
150
|
-
_dollyIn(e) {
|
|
151
|
-
this.object.isPerspectiveCamera || this.object.isOrthographicCamera ? this._scale *= e : (console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."), this.enableZoom = !1);
|
|
152
|
-
}
|
|
153
|
-
_updateZoomParameters(e, t) {
|
|
154
|
-
if (!this.zoomToCursor) return;
|
|
155
|
-
this._performCursorZoom = !0;
|
|
156
|
-
let n = this.domElement.getBoundingClientRect(), r = e - n.left, i = t - n.top, a = n.width, o = n.height;
|
|
157
|
-
this._mouse.x = r / a * 2 - 1, this._mouse.y = -(i / o) * 2 + 1, this._dollyDirection.set(this._mouse.x, this._mouse.y, 1).unproject(this.object).sub(this.object.position).normalize();
|
|
158
|
-
}
|
|
159
|
-
_clampDistance(e) {
|
|
160
|
-
return Math.max(this.minDistance, Math.min(this.maxDistance, e));
|
|
161
|
-
}
|
|
162
|
-
_handleMouseDownRotate(e) {
|
|
163
|
-
this._rotateStart.set(e.clientX, e.clientY);
|
|
164
|
-
}
|
|
165
|
-
_handleMouseDownDolly(e) {
|
|
166
|
-
this._updateZoomParameters(e.clientX, e.clientX), this._dollyStart.set(e.clientX, e.clientY);
|
|
167
|
-
}
|
|
168
|
-
_handleMouseDownPan(e) {
|
|
169
|
-
this._panStart.set(e.clientX, e.clientY);
|
|
170
|
-
}
|
|
171
|
-
_handleMouseMoveRotate(e) {
|
|
172
|
-
this._rotateEnd.set(e.clientX, e.clientY), this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
|
|
173
|
-
let t = this.domElement;
|
|
174
|
-
this._rotateLeft(N * this._rotateDelta.x / t.clientHeight), this._rotateUp(N * this._rotateDelta.y / t.clientHeight), this._rotateStart.copy(this._rotateEnd), this.update();
|
|
175
|
-
}
|
|
176
|
-
_handleMouseMoveDolly(e) {
|
|
177
|
-
this._dollyEnd.set(e.clientX, e.clientY), this._dollyDelta.subVectors(this._dollyEnd, this._dollyStart), this._dollyDelta.y > 0 ? this._dollyOut(this._getZoomScale(this._dollyDelta.y)) : this._dollyDelta.y < 0 && this._dollyIn(this._getZoomScale(this._dollyDelta.y)), this._dollyStart.copy(this._dollyEnd), this.update();
|
|
178
|
-
}
|
|
179
|
-
_handleMouseMovePan(e) {
|
|
180
|
-
this._panEnd.set(e.clientX, e.clientY), this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed), this._pan(this._panDelta.x, this._panDelta.y), this._panStart.copy(this._panEnd), this.update();
|
|
181
|
-
}
|
|
182
|
-
_handleMouseWheel(e) {
|
|
183
|
-
this._updateZoomParameters(e.clientX, e.clientY), e.deltaY < 0 ? this._dollyIn(this._getZoomScale(e.deltaY)) : e.deltaY > 0 && this._dollyOut(this._getZoomScale(e.deltaY)), this.update();
|
|
184
|
-
}
|
|
185
|
-
_handleKeyDown(e) {
|
|
186
|
-
let t = !1;
|
|
187
|
-
switch (e.code) {
|
|
188
|
-
case this.keys.UP:
|
|
189
|
-
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(N * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, this.keyPanSpeed), t = !0;
|
|
190
|
-
break;
|
|
191
|
-
case this.keys.BOTTOM:
|
|
192
|
-
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateUp(-N * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(0, -this.keyPanSpeed), t = !0;
|
|
193
|
-
break;
|
|
194
|
-
case this.keys.LEFT:
|
|
195
|
-
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(N * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(this.keyPanSpeed, 0), t = !0;
|
|
196
|
-
break;
|
|
197
|
-
case this.keys.RIGHT:
|
|
198
|
-
e.ctrlKey || e.metaKey || e.shiftKey ? this.enableRotate && this._rotateLeft(-N * this.keyRotateSpeed / this.domElement.clientHeight) : this.enablePan && this._pan(-this.keyPanSpeed, 0), t = !0;
|
|
199
|
-
break;
|
|
200
|
-
}
|
|
201
|
-
t && (e.preventDefault(), this.update());
|
|
202
|
-
}
|
|
203
|
-
_handleTouchStartRotate(e) {
|
|
204
|
-
if (this._pointers.length === 1) this._rotateStart.set(e.pageX, e.pageY);
|
|
205
|
-
else {
|
|
206
|
-
let t = this._getSecondPointerPosition(e), n = .5 * (e.pageX + t.x), r = .5 * (e.pageY + t.y);
|
|
207
|
-
this._rotateStart.set(n, r);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
_handleTouchStartPan(e) {
|
|
211
|
-
if (this._pointers.length === 1) this._panStart.set(e.pageX, e.pageY);
|
|
212
|
-
else {
|
|
213
|
-
let t = this._getSecondPointerPosition(e), n = .5 * (e.pageX + t.x), r = .5 * (e.pageY + t.y);
|
|
214
|
-
this._panStart.set(n, r);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
_handleTouchStartDolly(e) {
|
|
218
|
-
let t = this._getSecondPointerPosition(e), n = e.pageX - t.x, r = e.pageY - t.y, i = Math.sqrt(n * n + r * r);
|
|
219
|
-
this._dollyStart.set(0, i);
|
|
220
|
-
}
|
|
221
|
-
_handleTouchStartDollyPan(e) {
|
|
222
|
-
this.enableZoom && this._handleTouchStartDolly(e), this.enablePan && this._handleTouchStartPan(e);
|
|
223
|
-
}
|
|
224
|
-
_handleTouchStartDollyRotate(e) {
|
|
225
|
-
this.enableZoom && this._handleTouchStartDolly(e), this.enableRotate && this._handleTouchStartRotate(e);
|
|
226
|
-
}
|
|
227
|
-
_handleTouchMoveRotate(e) {
|
|
228
|
-
if (this._pointers.length == 1) this._rotateEnd.set(e.pageX, e.pageY);
|
|
229
|
-
else {
|
|
230
|
-
let t = this._getSecondPointerPosition(e), n = .5 * (e.pageX + t.x), r = .5 * (e.pageY + t.y);
|
|
231
|
-
this._rotateEnd.set(n, r);
|
|
232
|
-
}
|
|
233
|
-
this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart).multiplyScalar(this.rotateSpeed);
|
|
234
|
-
let t = this.domElement;
|
|
235
|
-
this._rotateLeft(N * this._rotateDelta.x / t.clientHeight), this._rotateUp(N * this._rotateDelta.y / t.clientHeight), this._rotateStart.copy(this._rotateEnd);
|
|
236
|
-
}
|
|
237
|
-
_handleTouchMovePan(e) {
|
|
238
|
-
if (this._pointers.length === 1) this._panEnd.set(e.pageX, e.pageY);
|
|
239
|
-
else {
|
|
240
|
-
let t = this._getSecondPointerPosition(e), n = .5 * (e.pageX + t.x), r = .5 * (e.pageY + t.y);
|
|
241
|
-
this._panEnd.set(n, r);
|
|
242
|
-
}
|
|
243
|
-
this._panDelta.subVectors(this._panEnd, this._panStart).multiplyScalar(this.panSpeed), this._pan(this._panDelta.x, this._panDelta.y), this._panStart.copy(this._panEnd);
|
|
244
|
-
}
|
|
245
|
-
_handleTouchMoveDolly(e) {
|
|
246
|
-
let t = this._getSecondPointerPosition(e), n = e.pageX - t.x, r = e.pageY - t.y, i = Math.sqrt(n * n + r * r);
|
|
247
|
-
this._dollyEnd.set(0, i), this._dollyDelta.set(0, Math.pow(this._dollyEnd.y / this._dollyStart.y, this.zoomSpeed)), this._dollyOut(this._dollyDelta.y), this._dollyStart.copy(this._dollyEnd);
|
|
248
|
-
let a = (e.pageX + t.x) * .5, o = (e.pageY + t.y) * .5;
|
|
249
|
-
this._updateZoomParameters(a, o);
|
|
250
|
-
}
|
|
251
|
-
_handleTouchMoveDollyPan(e) {
|
|
252
|
-
this.enableZoom && this._handleTouchMoveDolly(e), this.enablePan && this._handleTouchMovePan(e);
|
|
253
|
-
}
|
|
254
|
-
_handleTouchMoveDollyRotate(e) {
|
|
255
|
-
this.enableZoom && this._handleTouchMoveDolly(e), this.enableRotate && this._handleTouchMoveRotate(e);
|
|
256
|
-
}
|
|
257
|
-
_addPointer(e) {
|
|
258
|
-
this._pointers.push(e.pointerId);
|
|
259
|
-
}
|
|
260
|
-
_removePointer(e) {
|
|
261
|
-
delete this._pointerPositions[e.pointerId];
|
|
262
|
-
for (let t = 0; t < this._pointers.length; t++) if (this._pointers[t] == e.pointerId) {
|
|
263
|
-
this._pointers.splice(t, 1);
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
_isTrackingPointer(e) {
|
|
268
|
-
for (let t = 0; t < this._pointers.length; t++) if (this._pointers[t] == e.pointerId) return !0;
|
|
269
|
-
return !1;
|
|
270
|
-
}
|
|
271
|
-
_trackPointer(e) {
|
|
272
|
-
let t = this._pointerPositions[e.pointerId];
|
|
273
|
-
t === void 0 && (t = new v(), this._pointerPositions[e.pointerId] = t), t.set(e.pageX, e.pageY);
|
|
274
|
-
}
|
|
275
|
-
_getSecondPointerPosition(e) {
|
|
276
|
-
let t = e.pointerId === this._pointers[0] ? this._pointers[1] : this._pointers[0];
|
|
277
|
-
return this._pointerPositions[t];
|
|
278
|
-
}
|
|
279
|
-
_customWheelEvent(e) {
|
|
280
|
-
let t = e.deltaMode, n = {
|
|
281
|
-
clientX: e.clientX,
|
|
282
|
-
clientY: e.clientY,
|
|
283
|
-
deltaY: e.deltaY
|
|
284
|
-
};
|
|
285
|
-
switch (t) {
|
|
286
|
-
case 1:
|
|
287
|
-
n.deltaY *= 16;
|
|
288
|
-
break;
|
|
289
|
-
case 2:
|
|
290
|
-
n.deltaY *= 100;
|
|
291
|
-
break;
|
|
292
|
-
}
|
|
293
|
-
return e.ctrlKey && !this._controlActive && (n.deltaY *= 10), n;
|
|
294
|
-
}
|
|
295
|
-
};
|
|
296
|
-
function I(e) {
|
|
297
|
-
this.enabled !== !1 && (this._pointers.length === 0 && (this.domElement.setPointerCapture(e.pointerId), this.domElement.ownerDocument.addEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.addEventListener("pointerup", this._onPointerUp)), !this._isTrackingPointer(e) && (this._addPointer(e), e.pointerType === "touch" ? this._onTouchStart(e) : this._onMouseDown(e), this._cursorStyle === "grab" && (this.domElement.style.cursor = "grabbing")));
|
|
298
|
-
}
|
|
299
|
-
function L(e) {
|
|
300
|
-
this.enabled !== !1 && (e.pointerType === "touch" ? this._onTouchMove(e) : this._onMouseMove(e));
|
|
301
|
-
}
|
|
302
|
-
function R(e) {
|
|
303
|
-
switch (this._removePointer(e), this._pointers.length) {
|
|
304
|
-
case 0:
|
|
305
|
-
this.domElement.releasePointerCapture(e.pointerId), this.domElement.ownerDocument.removeEventListener("pointermove", this._onPointerMove), this.domElement.ownerDocument.removeEventListener("pointerup", this._onPointerUp), this.dispatchEvent(O), this.state = P.NONE, this._cursorStyle === "grab" && (this.domElement.style.cursor = "grab");
|
|
306
|
-
break;
|
|
307
|
-
case 1:
|
|
308
|
-
let t = this._pointers[0], n = this._pointerPositions[t];
|
|
309
|
-
this._onTouchStart({
|
|
310
|
-
pointerId: t,
|
|
311
|
-
pageX: n.x,
|
|
312
|
-
pageY: n.y
|
|
313
|
-
});
|
|
314
|
-
break;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
function z(e) {
|
|
318
|
-
let t;
|
|
319
|
-
switch (e.button) {
|
|
320
|
-
case 0:
|
|
321
|
-
t = this.mouseButtons.LEFT;
|
|
322
|
-
break;
|
|
323
|
-
case 1:
|
|
324
|
-
t = this.mouseButtons.MIDDLE;
|
|
325
|
-
break;
|
|
326
|
-
case 2:
|
|
327
|
-
t = this.mouseButtons.RIGHT;
|
|
328
|
-
break;
|
|
329
|
-
default: t = -1;
|
|
330
|
-
}
|
|
331
|
-
switch (t) {
|
|
332
|
-
case s.DOLLY:
|
|
333
|
-
if (this.enableZoom === !1) return;
|
|
334
|
-
this._handleMouseDownDolly(e), this.state = P.DOLLY;
|
|
335
|
-
break;
|
|
336
|
-
case s.ROTATE:
|
|
337
|
-
if (e.ctrlKey || e.metaKey || e.shiftKey) {
|
|
338
|
-
if (this.enablePan === !1) return;
|
|
339
|
-
this._handleMouseDownPan(e), this.state = P.PAN;
|
|
340
|
-
} else {
|
|
341
|
-
if (this.enableRotate === !1) return;
|
|
342
|
-
this._handleMouseDownRotate(e), this.state = P.ROTATE;
|
|
343
|
-
}
|
|
344
|
-
break;
|
|
345
|
-
case s.PAN:
|
|
346
|
-
if (e.ctrlKey || e.metaKey || e.shiftKey) {
|
|
347
|
-
if (this.enableRotate === !1) return;
|
|
348
|
-
this._handleMouseDownRotate(e), this.state = P.ROTATE;
|
|
349
|
-
} else {
|
|
350
|
-
if (this.enablePan === !1) return;
|
|
351
|
-
this._handleMouseDownPan(e), this.state = P.PAN;
|
|
352
|
-
}
|
|
353
|
-
break;
|
|
354
|
-
default: this.state = P.NONE;
|
|
355
|
-
}
|
|
356
|
-
this.state !== P.NONE && this.dispatchEvent(D);
|
|
357
|
-
}
|
|
358
|
-
function B(e) {
|
|
359
|
-
switch (this.state) {
|
|
360
|
-
case P.ROTATE:
|
|
361
|
-
if (this.enableRotate === !1) return;
|
|
362
|
-
this._handleMouseMoveRotate(e);
|
|
363
|
-
break;
|
|
364
|
-
case P.DOLLY:
|
|
365
|
-
if (this.enableZoom === !1) return;
|
|
366
|
-
this._handleMouseMoveDolly(e);
|
|
367
|
-
break;
|
|
368
|
-
case P.PAN:
|
|
369
|
-
if (this.enablePan === !1) return;
|
|
370
|
-
this._handleMouseMovePan(e);
|
|
371
|
-
break;
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
function V(e) {
|
|
375
|
-
this.enabled === !1 || this.enableZoom === !1 || this.state !== P.NONE || (e.preventDefault(), this.dispatchEvent(D), this._handleMouseWheel(this._customWheelEvent(e)), this.dispatchEvent(O));
|
|
376
|
-
}
|
|
377
|
-
function H(e) {
|
|
378
|
-
this.enabled !== !1 && this._handleKeyDown(e);
|
|
379
|
-
}
|
|
380
|
-
function U(e) {
|
|
381
|
-
switch (this._trackPointer(e), this._pointers.length) {
|
|
382
|
-
case 1:
|
|
383
|
-
switch (this.touches.ONE) {
|
|
384
|
-
case o.ROTATE:
|
|
385
|
-
if (this.enableRotate === !1) return;
|
|
386
|
-
this._handleTouchStartRotate(e), this.state = P.TOUCH_ROTATE;
|
|
387
|
-
break;
|
|
388
|
-
case o.PAN:
|
|
389
|
-
if (this.enablePan === !1) return;
|
|
390
|
-
this._handleTouchStartPan(e), this.state = P.TOUCH_PAN;
|
|
391
|
-
break;
|
|
392
|
-
default: this.state = P.NONE;
|
|
393
|
-
}
|
|
394
|
-
break;
|
|
395
|
-
case 2:
|
|
396
|
-
switch (this.touches.TWO) {
|
|
397
|
-
case o.DOLLY_PAN:
|
|
398
|
-
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
399
|
-
this._handleTouchStartDollyPan(e), this.state = P.TOUCH_DOLLY_PAN;
|
|
400
|
-
break;
|
|
401
|
-
case o.DOLLY_ROTATE:
|
|
402
|
-
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
403
|
-
this._handleTouchStartDollyRotate(e), this.state = P.TOUCH_DOLLY_ROTATE;
|
|
404
|
-
break;
|
|
405
|
-
default: this.state = P.NONE;
|
|
406
|
-
}
|
|
407
|
-
break;
|
|
408
|
-
default: this.state = P.NONE;
|
|
409
|
-
}
|
|
410
|
-
this.state !== P.NONE && this.dispatchEvent(D);
|
|
411
|
-
}
|
|
412
|
-
function W(e) {
|
|
413
|
-
switch (this._trackPointer(e), this.state) {
|
|
414
|
-
case P.TOUCH_ROTATE:
|
|
415
|
-
if (this.enableRotate === !1) return;
|
|
416
|
-
this._handleTouchMoveRotate(e), this.update();
|
|
417
|
-
break;
|
|
418
|
-
case P.TOUCH_PAN:
|
|
419
|
-
if (this.enablePan === !1) return;
|
|
420
|
-
this._handleTouchMovePan(e), this.update();
|
|
421
|
-
break;
|
|
422
|
-
case P.TOUCH_DOLLY_PAN:
|
|
423
|
-
if (this.enableZoom === !1 && this.enablePan === !1) return;
|
|
424
|
-
this._handleTouchMoveDollyPan(e), this.update();
|
|
425
|
-
break;
|
|
426
|
-
case P.TOUCH_DOLLY_ROTATE:
|
|
427
|
-
if (this.enableZoom === !1 && this.enableRotate === !1) return;
|
|
428
|
-
this._handleTouchMoveDollyRotate(e), this.update();
|
|
429
|
-
break;
|
|
430
|
-
default: this.state = P.NONE;
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
function G(e) {
|
|
434
|
-
this.enabled !== !1 && e.preventDefault();
|
|
435
|
-
}
|
|
436
|
-
function K(e) {
|
|
437
|
-
e.key === "Control" && (this._controlActive = !0, this.domElement.getRootNode().addEventListener("keyup", this._interceptControlUp, {
|
|
438
|
-
passive: !0,
|
|
439
|
-
capture: !0
|
|
440
|
-
}));
|
|
441
|
-
}
|
|
442
|
-
function q(e) {
|
|
443
|
-
e.key === "Control" && (this._controlActive = !1, this.domElement.getRootNode().removeEventListener("keyup", this._interceptControlUp, {
|
|
444
|
-
passive: !0,
|
|
445
|
-
capture: !0
|
|
446
|
-
}));
|
|
447
|
-
}
|
|
448
|
-
//#endregion
|
|
449
|
-
//#region src/package/vendors/model/ModelViewer.vue?vue&type=script&setup=true&lang.ts
|
|
450
|
-
var ge = { class: "model-viewer" }, _e = { class: "model-toolbar" }, ve = { class: "model-actions" }, ye = { class: "model-meta" }, be = { class: "model-stage" }, xe = {
|
|
451
|
-
key: 0,
|
|
452
|
-
class: "model-state"
|
|
453
|
-
}, Se = {
|
|
454
|
-
key: 1,
|
|
455
|
-
class: "model-state error"
|
|
456
|
-
}, J = /*#__PURE__*/ n(/* @__PURE__ */ x({
|
|
457
|
-
__name: "ModelViewer",
|
|
458
|
-
props: {
|
|
459
|
-
data: {},
|
|
460
|
-
type: {},
|
|
461
|
-
sourceUrl: {}
|
|
462
|
-
},
|
|
463
|
-
setup(e) {
|
|
464
|
-
let n = e, o = w(null), s = w("loading"), u = w(""), f = w("正在加载模型"), p = w(!1), g = w(!1), _ = w(!0), v = w(!0), x = null, E = null, D = null, O = null, k = null, A = null, j = null, M = null, N = 0, P = 0, F = null, I = new a(), L = new TextDecoder("utf-8");
|
|
465
|
-
class R extends Error {}
|
|
466
|
-
let z = () => n.type.toLowerCase(), B = () => {
|
|
467
|
-
if (!n.sourceUrl) return "";
|
|
468
|
-
try {
|
|
469
|
-
return new URL(".", n.sourceUrl).href;
|
|
470
|
-
} catch (e) {
|
|
471
|
-
let t = n.sourceUrl.split(/[?#]/)[0] || n.sourceUrl, r = t.lastIndexOf("/");
|
|
472
|
-
return r >= 0 ? t.slice(0, r + 1) : "";
|
|
473
|
-
}
|
|
474
|
-
}, V = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : JSON.stringify(e), H = () => {
|
|
475
|
-
let e = o.value;
|
|
476
|
-
if (!e) return !1;
|
|
477
|
-
if (x || (x = new ce({
|
|
478
|
-
antialias: !0,
|
|
479
|
-
alpha: !1,
|
|
480
|
-
canvas: e,
|
|
481
|
-
powerPreference: "high-performance"
|
|
482
|
-
}), x.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2)), x.outputColorSpace = le, x.setClearColor(16317180, 1)), !E) {
|
|
483
|
-
E = new te(), E.background = new oe(16317180);
|
|
484
|
-
let e = new i(16777215, 14147304, 2.4);
|
|
485
|
-
E.add(e);
|
|
486
|
-
let t = new h(16777215, 2.2);
|
|
487
|
-
t.position.set(8, 10, 8), E.add(t);
|
|
488
|
-
let n = new h(16777215, .9);
|
|
489
|
-
n.position.set(-7, 5, -4), E.add(n), A = new ee(10, 10, 13358561, 14870768), E.add(A), j = new re(3), E.add(j);
|
|
490
|
-
}
|
|
491
|
-
return D || (D = new se(45, 1, .01, 1e5), D.position.set(5, 4, 6)), !O && D && x && (O = new he(D, x.domElement), O.enableDamping = !0, O.dampingFactor = .08, O.screenSpacePanning = !0, O.autoRotateSpeed = 1.2), $(), We(), !0;
|
|
492
|
-
}, U = (e) => {
|
|
493
|
-
(Array.isArray(e) ? e : [e]).forEach((e) => e.dispose());
|
|
494
|
-
}, W = (e) => {
|
|
495
|
-
e.traverse((e) => {
|
|
496
|
-
let t = e, n = e;
|
|
497
|
-
t.geometry && t.geometry.dispose(), t.material && U(t.material), n.material && U(n.material);
|
|
498
|
-
});
|
|
499
|
-
}, G = () => {
|
|
500
|
-
k && E && (E.remove(k), W(k)), k = null, F = null;
|
|
501
|
-
}, K = () => L.decode(n.data), q = function() {
|
|
502
|
-
var e = t(function* () {
|
|
503
|
-
let { GLTFLoader: e } = yield import("./GLTFLoader.js"), t = new e(), r = B(), i = z() === "gltf" ? K() : n.data;
|
|
504
|
-
return new Promise((e, n) => {
|
|
505
|
-
t.parse(i, r, (t) => {
|
|
506
|
-
var n;
|
|
507
|
-
(n = t.animations) != null && n.length && (F = new d(t.scene), t.animations.forEach((e) => F == null ? void 0 : F.clipAction(e).play())), e(t.scene);
|
|
508
|
-
}, n);
|
|
509
|
-
});
|
|
510
|
-
});
|
|
511
|
-
return function() {
|
|
512
|
-
return e.apply(this, arguments);
|
|
513
|
-
};
|
|
514
|
-
}(), J = function() {
|
|
515
|
-
var e = t(function* () {
|
|
516
|
-
let { OBJLoader: e } = yield import("./OBJLoader.js");
|
|
517
|
-
return new e().parse(K());
|
|
518
|
-
});
|
|
519
|
-
return function() {
|
|
520
|
-
return e.apply(this, arguments);
|
|
521
|
-
};
|
|
522
|
-
}(), Ce = function() {
|
|
523
|
-
var e = t(function* () {
|
|
524
|
-
let { STLLoader: e } = yield import("./STLLoader.js"), t = new e().parse(n.data);
|
|
525
|
-
return t.computeVertexNormals(), new l(t, Y());
|
|
526
|
-
});
|
|
527
|
-
return function() {
|
|
528
|
-
return e.apply(this, arguments);
|
|
529
|
-
};
|
|
530
|
-
}(), we = function() {
|
|
531
|
-
var e = t(function* () {
|
|
532
|
-
let { PLYLoader: e } = yield import("./PLYLoader.js"), t = new e().parse(n.data);
|
|
533
|
-
return t.computeVertexNormals(), new l(t, Y());
|
|
534
|
-
});
|
|
535
|
-
return function() {
|
|
536
|
-
return e.apply(this, arguments);
|
|
537
|
-
};
|
|
538
|
-
}(), Te = function() {
|
|
539
|
-
var e = t(function* () {
|
|
540
|
-
var e;
|
|
541
|
-
let { FBXLoader: t } = yield import("./FBXLoader.js"), r = new t().parse(n.data, B());
|
|
542
|
-
return (e = r.animations) != null && e.length && (F = new d(r), r.animations.forEach((e) => F == null ? void 0 : F.clipAction(e).play())), r;
|
|
543
|
-
});
|
|
544
|
-
return function() {
|
|
545
|
-
return e.apply(this, arguments);
|
|
546
|
-
};
|
|
547
|
-
}(), Ee = function() {
|
|
548
|
-
var e = t(function* () {
|
|
549
|
-
let { ColladaLoader: e } = yield import("./ColladaLoader.js");
|
|
550
|
-
return new e().parse(K(), B()).scene;
|
|
551
|
-
});
|
|
552
|
-
return function() {
|
|
553
|
-
return e.apply(this, arguments);
|
|
554
|
-
};
|
|
555
|
-
}(), De = function() {
|
|
556
|
-
var e = t(function* () {
|
|
557
|
-
let { TDSLoader: e } = yield import("./TDSLoader.js");
|
|
558
|
-
return new e().parse(n.data, B());
|
|
559
|
-
});
|
|
560
|
-
return function() {
|
|
561
|
-
return e.apply(this, arguments);
|
|
562
|
-
};
|
|
563
|
-
}(), Oe = function() {
|
|
564
|
-
var e = t(function* () {
|
|
565
|
-
let { ThreeMFLoader: e } = yield import("./3MFLoader.js");
|
|
566
|
-
return new e().parse(n.data);
|
|
567
|
-
});
|
|
568
|
-
return function() {
|
|
569
|
-
return e.apply(this, arguments);
|
|
570
|
-
};
|
|
571
|
-
}(), ke = function() {
|
|
572
|
-
var e = t(function* () {
|
|
573
|
-
let { AMFLoader: e } = yield import("./AMFLoader.js");
|
|
574
|
-
return new e().parse(n.data);
|
|
575
|
-
});
|
|
576
|
-
return function() {
|
|
577
|
-
return e.apply(this, arguments);
|
|
578
|
-
};
|
|
579
|
-
}(), Ae = function() {
|
|
580
|
-
var e = t(function* () {
|
|
581
|
-
let { USDLoader: e } = yield import("./USDLoader.js");
|
|
582
|
-
return new e().parse(n.data);
|
|
583
|
-
});
|
|
584
|
-
return function() {
|
|
585
|
-
return e.apply(this, arguments);
|
|
586
|
-
};
|
|
587
|
-
}(), je = function() {
|
|
588
|
-
var e = t(function* () {
|
|
589
|
-
let { KMZLoader: e } = yield import("./KMZLoader.js");
|
|
590
|
-
return new e().parse(n.data).scene;
|
|
591
|
-
});
|
|
592
|
-
return function() {
|
|
593
|
-
return e.apply(this, arguments);
|
|
594
|
-
};
|
|
595
|
-
}(), Me = (e) => {
|
|
596
|
-
let t = e.toUpperCase();
|
|
597
|
-
throw e === "ifc" ? new R("IFC 是 BIM 模型格式,浏览器端完整解析通常依赖 web-ifc 这类 WebAssembly BIM 内核。当前 Apache-2.0 前端包不默认打入这类重型运行时,建议在私有服务端转换为 GLB/GLTF 后预览。") : e === "3dm" ? new R("3DM 是 Rhino/OpenNURBS 模型格式,浏览器端解析需要 rhino3dm WebAssembly 运行时。当前前端包未内置该运行时,建议在私有转换链路输出 GLB/GLTF 后预览。") : new R(`${t} 属于 CAD B-Rep / 工程交换格式,浏览器端完整解析通常需要 OpenCascade 等 WebAssembly 几何内核。当前前端包不默认打入这类重型运行时,建议在私有服务端转换为 GLB/GLTF 或轻量网格格式后预览。`);
|
|
598
|
-
}, Ne = function() {
|
|
599
|
-
var e = t(function* () {
|
|
600
|
-
let { PCDLoader: e } = yield import("./PCDLoader.js");
|
|
601
|
-
return new e().parse(n.data, n.sourceUrl || "model.pcd");
|
|
602
|
-
});
|
|
603
|
-
return function() {
|
|
604
|
-
return e.apply(this, arguments);
|
|
605
|
-
};
|
|
606
|
-
}(), Pe = function() {
|
|
607
|
-
var e = t(function* () {
|
|
608
|
-
let { VRMLLoader: e } = yield import("./VRMLLoader.js");
|
|
609
|
-
return new e().parse(K(), B());
|
|
610
|
-
});
|
|
611
|
-
return function() {
|
|
612
|
-
return e.apply(this, arguments);
|
|
613
|
-
};
|
|
614
|
-
}(), Fe = function() {
|
|
615
|
-
var e = t(function* () {
|
|
616
|
-
let { XYZLoader: e } = yield import("./XYZLoader.js"), t = new e().parse(K());
|
|
617
|
-
return t.computeBoundingSphere(), new ae(t, Le());
|
|
618
|
-
});
|
|
619
|
-
return function() {
|
|
620
|
-
return e.apply(this, arguments);
|
|
621
|
-
};
|
|
622
|
-
}(), Ie = function() {
|
|
623
|
-
var e = t(function* () {
|
|
624
|
-
let { VTKLoader: e } = yield import("./VTKLoader.js"), t = new e().parse(n.data);
|
|
625
|
-
return t.computeVertexNormals(), new l(t, Y());
|
|
626
|
-
});
|
|
627
|
-
return function() {
|
|
628
|
-
return e.apply(this, arguments);
|
|
629
|
-
};
|
|
630
|
-
}(), Y = () => new ie({
|
|
631
|
-
color: 5214138,
|
|
632
|
-
metalness: .08,
|
|
633
|
-
roughness: .78,
|
|
634
|
-
side: 2,
|
|
635
|
-
wireframe: g.value
|
|
636
|
-
}), Le = () => new ne({
|
|
637
|
-
color: 2062988,
|
|
638
|
-
size: .035,
|
|
639
|
-
sizeAttenuation: !0
|
|
640
|
-
}), X = (e) => {
|
|
641
|
-
e.traverse((e) => {
|
|
642
|
-
let t = e;
|
|
643
|
-
t.isMesh && !t.material && (t.material = Y()), t.isMesh && t.material && (Array.isArray(t.material) ? t.material : [t.material]).forEach((e) => {
|
|
644
|
-
"wireframe" in e && (e.wireframe = g.value), e.needsUpdate = !0;
|
|
645
|
-
});
|
|
646
|
-
});
|
|
647
|
-
}, Re = (e) => {
|
|
648
|
-
let t = 0, n = 0;
|
|
649
|
-
return e.traverse((e) => {
|
|
650
|
-
e.isMesh && (t += 1), e.isPoints && (n += 1);
|
|
651
|
-
}), {
|
|
652
|
-
meshes: t,
|
|
653
|
-
points: n
|
|
654
|
-
};
|
|
655
|
-
}, ze = (e) => {
|
|
656
|
-
let { meshes: t, points: n } = Re(e), r = [];
|
|
657
|
-
t && r.push(`${t} 个网格`), n && r.push(`${n} 个点云`), f.value = r.length ? r.join(",") : "模型已加载";
|
|
658
|
-
}, Be = (e) => {
|
|
659
|
-
let t = new m().setFromObject(e);
|
|
660
|
-
if (t.isEmpty()) return {
|
|
661
|
-
center: new r(),
|
|
662
|
-
size: new r(4, 4, 4)
|
|
663
|
-
};
|
|
664
|
-
let n = t.getCenter(new r()), i = t.getSize(new r());
|
|
665
|
-
return e.position.sub(n), {
|
|
666
|
-
center: new r(),
|
|
667
|
-
size: i
|
|
668
|
-
};
|
|
669
|
-
}, Z = () => {
|
|
670
|
-
if (!k || !D || !O) return;
|
|
671
|
-
let e = new m().setFromObject(k), t = e.getSize(new r()), n = e.getCenter(new r()), i = Math.max(t.x, t.y, t.z, 1) / (2 * Math.tan(c.degToRad(D.fov / 2))) * 1.65;
|
|
672
|
-
D.near = Math.max(i / 1e3, .01), D.far = Math.max(i * 1e3, 1e3), D.position.copy(n).add(new r(i, i * .62, i)), D.updateProjectionMatrix(), O.target.copy(n), O.update();
|
|
673
|
-
}, Ve = function() {
|
|
674
|
-
var e = t(function* (e) {
|
|
675
|
-
if (!E) return;
|
|
676
|
-
G(), X(e);
|
|
677
|
-
let { size: t } = Be(e);
|
|
678
|
-
k = e, E.add(e), Z(), ze(e);
|
|
679
|
-
let n = Math.max(t.x, t.y, t.z, 1);
|
|
680
|
-
A && A.scale.setScalar(Math.max(n / 10, 1));
|
|
681
|
-
});
|
|
682
|
-
return function(t) {
|
|
683
|
-
return e.apply(this, arguments);
|
|
684
|
-
};
|
|
685
|
-
}(), He = function() {
|
|
686
|
-
var e = t(function* () {
|
|
687
|
-
let e = ++P;
|
|
688
|
-
if (s.value = "loading", u.value = "", f.value = "正在加载模型", H()) try {
|
|
689
|
-
let t = yield Ue(z());
|
|
690
|
-
if (e !== P) {
|
|
691
|
-
W(t);
|
|
692
|
-
return;
|
|
693
|
-
}
|
|
694
|
-
yield de(), yield Ve(t), s.value = "ready";
|
|
695
|
-
} catch (t) {
|
|
696
|
-
if (e !== P) return;
|
|
697
|
-
t instanceof R || console.error(t), s.value = "error", u.value = V(t) || `${n.type.toUpperCase()} 模型解析失败`;
|
|
698
|
-
}
|
|
699
|
-
});
|
|
700
|
-
return function() {
|
|
701
|
-
return e.apply(this, arguments);
|
|
702
|
-
};
|
|
703
|
-
}(), Ue = (e) => {
|
|
704
|
-
switch (e) {
|
|
705
|
-
case "glb":
|
|
706
|
-
case "gltf": return q();
|
|
707
|
-
case "obj": return J();
|
|
708
|
-
case "stl": return Ce();
|
|
709
|
-
case "ply": return we();
|
|
710
|
-
case "fbx": return Te();
|
|
711
|
-
case "dae": return Ee();
|
|
712
|
-
case "3ds": return De();
|
|
713
|
-
case "3mf": return Oe();
|
|
714
|
-
case "amf": return ke();
|
|
715
|
-
case "usd":
|
|
716
|
-
case "usda":
|
|
717
|
-
case "usdc":
|
|
718
|
-
case "usdz": return Ae();
|
|
719
|
-
case "kmz": return je();
|
|
720
|
-
case "step":
|
|
721
|
-
case "stp":
|
|
722
|
-
case "iges":
|
|
723
|
-
case "igs":
|
|
724
|
-
case "ifc":
|
|
725
|
-
case "3dm": return Me(e);
|
|
726
|
-
case "pcd": return Ne();
|
|
727
|
-
case "wrl":
|
|
728
|
-
case "vrml": return Pe();
|
|
729
|
-
case "xyz": return Fe();
|
|
730
|
-
case "vtk":
|
|
731
|
-
case "vtp": return Ie();
|
|
732
|
-
default: throw Error(`暂不支持 .${e} 模型格式`);
|
|
733
|
-
}
|
|
734
|
-
}, We = () => {
|
|
735
|
-
let e = o.value;
|
|
736
|
-
if (!e || !x || !D) return;
|
|
737
|
-
let t = e.getBoundingClientRect(), n = Math.max(1, Math.floor(t.width)), r = Math.max(1, Math.floor(t.height));
|
|
738
|
-
x.setSize(n, r, !1), D.aspect = n / r, D.updateProjectionMatrix();
|
|
739
|
-
}, Q = (e) => {
|
|
740
|
-
if (!x || !E || !D || !O) return;
|
|
741
|
-
O.autoRotate = p.value, O.update(), I.update(e);
|
|
742
|
-
let t = I.getDelta();
|
|
743
|
-
F == null || F.update(t), x.render(E, D), N = requestAnimationFrame(Q);
|
|
744
|
-
}, Ge = () => {
|
|
745
|
-
k && X(k);
|
|
746
|
-
}, $ = () => {
|
|
747
|
-
A && (A.visible = _.value), j && (j.visible = v.value);
|
|
748
|
-
}, Ke = () => {
|
|
749
|
-
g.value = !g.value, Ge();
|
|
750
|
-
}, qe = () => {
|
|
751
|
-
_.value = !_.value, $();
|
|
752
|
-
}, Je = () => {
|
|
753
|
-
v.value = !v.value, $();
|
|
754
|
-
};
|
|
755
|
-
return pe(() => {
|
|
756
|
-
H() && (I.connect(document), M = new ResizeObserver(We), o.value && M.observe(o.value), Q(), He());
|
|
757
|
-
}), fe(() => {
|
|
758
|
-
P += 1, cancelAnimationFrame(N), M == null || M.disconnect(), M = null, G(), O == null || O.dispose(), O = null, x == null || x.dispose(), x = null, I.dispose(), I = new a(), E = null, D = null, A = null, j = null;
|
|
759
|
-
}), me(() => [
|
|
760
|
-
n.data,
|
|
761
|
-
n.type,
|
|
762
|
-
n.sourceUrl
|
|
763
|
-
], () => {
|
|
764
|
-
He();
|
|
765
|
-
}), (t, n) => (C(), y("div", ge, [b("div", _e, [b("div", ve, [
|
|
766
|
-
b("button", {
|
|
767
|
-
type: "button",
|
|
768
|
-
onClick: Z
|
|
769
|
-
}, "适配"),
|
|
770
|
-
b("button", {
|
|
771
|
-
type: "button",
|
|
772
|
-
class: S({ active: p.value }),
|
|
773
|
-
onClick: n[0] || (n[0] = (e) => p.value = !p.value)
|
|
774
|
-
}, "旋转", 2),
|
|
775
|
-
b("button", {
|
|
776
|
-
type: "button",
|
|
777
|
-
class: S({ active: g.value }),
|
|
778
|
-
onClick: Ke
|
|
779
|
-
}, "线框", 2),
|
|
780
|
-
b("button", {
|
|
781
|
-
type: "button",
|
|
782
|
-
class: S({ active: _.value }),
|
|
783
|
-
onClick: qe
|
|
784
|
-
}, "网格", 2),
|
|
785
|
-
b("button", {
|
|
786
|
-
type: "button",
|
|
787
|
-
class: S({ active: v.value }),
|
|
788
|
-
onClick: Je
|
|
789
|
-
}, "坐标", 2)
|
|
790
|
-
]), b("div", ye, [b("strong", null, T(e.type.toUpperCase()), 1), b("span", null, T(f.value), 1)])]), b("div", be, [b("canvas", {
|
|
791
|
-
ref_key: "canvas",
|
|
792
|
-
ref: o
|
|
793
|
-
}, null, 512), s.value === "loading" ? (C(), y("div", xe, "正在解析 3D 模型...")) : s.value === "error" ? (C(), y("div", Se, [n[1] || (n[1] = b("strong", null, "模型解析失败", -1)), b("span", null, T(u.value), 1)])) : ue("", !0)])]));
|
|
794
|
-
}
|
|
795
|
-
}), [["__scopeId", "data-v-9d2e23df"]]);
|
|
796
|
-
//#endregion
|
|
797
|
-
export { J as default };
|