mirror of
https://github.com/yeicor-3d/yet-another-cad-viewer.git
synced 2025-12-20 14:37:03 +01:00
reduce index bundle size
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
"author": "Yeicor",
|
"author": "Yeicor",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "parcel src/index.html",
|
"start": "parcel src/index.html",
|
||||||
"build": "yarn update-licenses && parcel build src/index.html --reporter @parcel/reporter-bundle-analyzer --detailed-report",
|
"build": "yarn update-licenses && parcel build src/index.html --reporter @parcel/reporter-bundle-analyzer --detailed-report --public-url ./",
|
||||||
"update-licenses": "generate-license-file --input package.json --output assets/licenses.txt --overwrite"
|
"update-licenses": "generate-license-file --input package.json --output assets/licenses.txt --overwrite"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
import {Document, TypedArray} from '@gltf-transform/core'
|
import {Document, TypedArray} from '@gltf-transform/core'
|
||||||
import {Matrix4, Vector2, Vector3} from 'three'
|
import {Vector2} from 'three/src/math/Vector2'
|
||||||
|
import {Vector3} from 'three/src/math/Vector3'
|
||||||
|
import {Box3} from 'three/src/math/Box3'
|
||||||
|
import {Matrix4} from 'three/src/math/Matrix4'
|
||||||
|
|
||||||
|
|
||||||
/** Exports the colors used for the axes, primary and secondary. They match the orientation gizmo. */
|
/** Exports the colors used for the axes, primary and secondary. They match the orientation gizmo. */
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ import {Ref, ShallowRef} from 'vue';
|
|||||||
import {Document} from '@gltf-transform/core';
|
import {Document} from '@gltf-transform/core';
|
||||||
import {extrasNameKey, extrasNameValueHelpers, mergeFinalize, mergePartial, removeModel, toBuffer} from "./gltf";
|
import {extrasNameKey, extrasNameValueHelpers, mergeFinalize, mergePartial, removeModel, toBuffer} from "./gltf";
|
||||||
import {newAxes, newGridBox} from "./helpers";
|
import {newAxes, newGridBox} from "./helpers";
|
||||||
import {Box3, Matrix4, Vector3} from 'three';
|
import {Vector3} from 'three/src/math/Vector3'
|
||||||
|
import {Box3} from 'three/src/math/Box3'
|
||||||
|
import {Matrix4} from 'three/src/math/Matrix4'
|
||||||
|
|
||||||
/** This class helps manage SceneManagerData. All methods are static to support reactivity... */
|
/** This class helps manage SceneManagerData. All methods are static to support reactivity... */
|
||||||
export class SceneMgr {
|
export class SceneMgr {
|
||||||
|
|||||||
@@ -25,8 +25,12 @@ import {
|
|||||||
mdiVectorRectangle
|
mdiVectorRectangle
|
||||||
} from '@mdi/js'
|
} from '@mdi/js'
|
||||||
import SvgIcon from '@jamescoyle/vue-icon';
|
import SvgIcon from '@jamescoyle/vue-icon';
|
||||||
import {BackSide, Box3, Color, FrontSide, Mesh as TMesh, Plane, Vector3} from "three";
|
|
||||||
import {SceneMgr} from "../misc/scene";
|
import {SceneMgr} from "../misc/scene";
|
||||||
|
import {BackSide, FrontSide} from "three/src/constants";
|
||||||
|
import {Box3} from "three/src/math/Box3";
|
||||||
|
import {Color} from "three/src/math/Color";
|
||||||
|
import {Plane} from "three/src/math/Plane";
|
||||||
|
import {Vector3} from "three/src/math/Vector3";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
meshes: Array<Mesh>,
|
meshes: Array<Mesh>,
|
||||||
@@ -224,15 +228,15 @@ props.viewer.onElemReady((elem) => elem.addEventListener('load', onModelLoad))
|
|||||||
<v-btn-toggle v-model="enabledFeatures" multiple @click.stop color="surface-light">
|
<v-btn-toggle v-model="enabledFeatures" multiple @click.stop color="surface-light">
|
||||||
<v-btn icon>
|
<v-btn icon>
|
||||||
<v-tooltip activator="parent">Toggle Faces ({{ faceCount }})</v-tooltip>
|
<v-tooltip activator="parent">Toggle Faces ({{ faceCount }})</v-tooltip>
|
||||||
<svg-icon type="mdi" :path="mdiRectangle"></svg-icon>
|
<svg-icon type="mdi" :path="mdiRectangle" :rotate="90"></svg-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<v-btn icon>
|
<v-btn icon>
|
||||||
<v-tooltip activator="parent">Toggle Edges ({{ edgeCount }})</v-tooltip>
|
<v-tooltip activator="parent">Toggle Edges ({{ edgeCount }})</v-tooltip>
|
||||||
<svg-icon type="mdi" :path="mdiRectangleOutline"></svg-icon>
|
<svg-icon type="mdi" :path="mdiRectangleOutline" :rotate="90"></svg-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<v-btn icon>
|
<v-btn icon>
|
||||||
<v-tooltip activator="parent">Toggle Vertices ({{ vertexCount }})</v-tooltip>
|
<v-tooltip activator="parent">Toggle Vertices ({{ vertexCount }})</v-tooltip>
|
||||||
<svg-icon type="mdi" :path="mdiVectorRectangle"></svg-icon>
|
<svg-icon type="mdi" :path="mdiVectorRectangle" :rotate="90"></svg-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</v-btn-toggle>
|
</v-btn-toggle>
|
||||||
<div class="model-name">{{ modelName }}</div>
|
<div class="model-name">{{ modelName }}</div>
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ defineExpose({findModel})
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Loading v-if="!props.document"/>
|
<Loading v-if="!props.document"/>
|
||||||
<v-expansion-panels v-else v-for="meshes in meshesList(props.document)" :key="meshName(meshes[0])" v-model="expandedNames" multiple>
|
<v-expansion-panels v-else v-for="meshes in meshesList(props.document)" :key="meshName(meshes[0])"
|
||||||
|
v-model="expandedNames" multiple>
|
||||||
<model :meshes="meshes" :viewer="props.viewer" :document="props.document" @remove="onRemove(meshes[0])"/>
|
<model :meshes="meshes" :viewer="props.viewer" :document="props.document" @remove="onRemove(meshes[0])"/>
|
||||||
</v-expansion-panels>
|
</v-expansion-panels>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
2
src/shims.d.ts
vendored
2
src/shims.d.ts
vendored
@@ -1,6 +1,8 @@
|
|||||||
// Avoids typescript error when importing files
|
// Avoids typescript error when importing files
|
||||||
declare module '*.vue'
|
declare module '*.vue'
|
||||||
|
declare module '@jamescoyle/vue-icon'
|
||||||
declare module 'three-orientation-gizmo/src/OrientationGizmo'
|
declare module 'three-orientation-gizmo/src/OrientationGizmo'
|
||||||
declare module 'vuetify/lib/styles/main.sass'
|
declare module 'vuetify/lib/styles/main.sass'
|
||||||
declare module '@mdi/font/css/materialdesignicons.css'
|
declare module '@mdi/font/css/materialdesignicons.css'
|
||||||
|
declare module 'vuetify/lib/components'
|
||||||
declare module 'vuetify/lib/directives'
|
declare module 'vuetify/lib/directives'
|
||||||
@@ -11,7 +11,7 @@ import {ModelViewerElement} from '@google/model-viewer';
|
|||||||
import type {ModelScene} from "@google/model-viewer/lib/three-components/ModelScene";
|
import type {ModelScene} from "@google/model-viewer/lib/three-components/ModelScene";
|
||||||
import {Hotspot} from "@google/model-viewer/lib/three-components/Hotspot";
|
import {Hotspot} from "@google/model-viewer/lib/three-components/Hotspot";
|
||||||
import type {Renderer} from "@google/model-viewer/lib/three-components/Renderer";
|
import type {Renderer} from "@google/model-viewer/lib/three-components/Renderer";
|
||||||
import {Vector3} from "three";
|
import type {Vector3} from "three";
|
||||||
|
|
||||||
ModelViewerElement.modelCacheSize = 0; // Also needed to avoid tree shaking
|
ModelViewerElement.modelCacheSize = 0; // Also needed to avoid tree shaking
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user