mirror of
https://github.com/yeicor-3d/yet-another-cad-viewer.git
synced 2026-01-28 17:14:14 +01:00
add licenses to frontend
This commit is contained in:
@@ -16,21 +16,21 @@ const openIcon = props.side === 'left' ? mdiChevronRight : mdiChevronLeft;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-btn icon="" @click="opened = !opened" class="open-button" :class="side">
|
||||
<v-btn icon @click="opened = !opened" class="open-button" :class="side">
|
||||
<svg-icon type="mdi" :path="openIcon"/>
|
||||
</v-btn>
|
||||
<v-navigation-drawer v-model="opened" permanent :location="side" :width="props.width">
|
||||
<v-toolbar density="compact">
|
||||
<v-toolbar-items v-if="side == 'right'">
|
||||
<slot name="toolbar-items"></slot>
|
||||
<v-btn icon="" @click="opened = !opened">
|
||||
<v-btn icon @click="opened = !opened">
|
||||
<svg-icon type="mdi" :path="mdiClose"/>
|
||||
</v-btn>
|
||||
</v-toolbar-items>
|
||||
<slot name="toolbar"></slot>
|
||||
<v-toolbar-items v-if="side == 'left'">
|
||||
<slot name="toolbar-items"></slot>
|
||||
<v-btn icon="" @click="opened = !opened">
|
||||
<v-btn icon @click="opened = !opened">
|
||||
<svg-icon type="mdi" :path="mdiClose"/>
|
||||
</v-btn>
|
||||
</v-toolbar-items>
|
||||
|
||||
@@ -11,20 +11,20 @@ let io = new WebIO();
|
||||
* Remember to call mergeFinalize after all models have been merged (slower required operations).
|
||||
*/
|
||||
export async function mergePartial(glb: Uint8Array, name: string, document: Document): Promise<Document> {
|
||||
|
||||
// Load the new document
|
||||
let newDoc = await io.readBinary(glb);
|
||||
|
||||
// Remove any previous model with the same name and ensure consistent names
|
||||
// noinspection TypeScriptValidateJSTypes
|
||||
await newDoc.transform(dropByName(name), setNames(name));
|
||||
|
||||
let merged = document.merge(newDoc);
|
||||
|
||||
// noinspection TypeScriptValidateJSTypes
|
||||
return await merged.transform(mergeScenes()); // Single scene & buffer required!
|
||||
// Merge the new document into the current one
|
||||
return document.merge(newDoc);
|
||||
}
|
||||
|
||||
export async function mergeFinalize(document: Document): Promise<Document> {
|
||||
return await document.transform(unpartition());
|
||||
// Single scene & buffer required before loading & rendering
|
||||
return await document.transform(mergeScenes(), unpartition());
|
||||
}
|
||||
|
||||
export async function toBuffer(doc: Document): Promise<Uint8Array> {
|
||||
|
||||
15
src/tools/LicensesDialogContent.vue
Normal file
15
src/tools/LicensesDialogContent.vue
Normal file
@@ -0,0 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
// License text for all dependencies, only downloaded when/if needed
|
||||
// @ts-ignore
|
||||
const licenseText = await import("bundle-text:../../assets/licenses.txt");
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<pre class="license-text" v-html="licenseText"/>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.license-text {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
</style>
|
||||
@@ -128,7 +128,7 @@ function toggleSelection() {
|
||||
|
||||
<template>
|
||||
<div class="select-parent">
|
||||
<v-btn icon="" @click="toggleSelection" :variant="selectionEnabled ? 'tonal' : 'elevated'">
|
||||
<v-btn icon @click="toggleSelection" :variant="selectionEnabled ? 'tonal' : 'elevated'">
|
||||
<svg-icon type="mdi" :path="mdiCursorDefaultClick"/>
|
||||
</v-btn>
|
||||
<v-select class="select-only" variant="underlined" :items="['Faces', 'Edges', 'Vertices']" v-model="selectFilter"/>
|
||||
|
||||
@@ -1,16 +1,26 @@
|
||||
<script setup lang="ts">
|
||||
import {VBtn, VDivider} from "vuetify/lib/components";
|
||||
import {
|
||||
VBtn,
|
||||
VCard,
|
||||
VCardText,
|
||||
VDialog,
|
||||
VDivider,
|
||||
VSpacer,
|
||||
VToolbar,
|
||||
VToolbarTitle
|
||||
} from "vuetify/lib/components";
|
||||
import {Ref, ref, Suspense} from "vue";
|
||||
import OrientationGizmo from "./OrientationGizmo.vue";
|
||||
import type {PerspectiveCamera} from "three/src/cameras/PerspectiveCamera";
|
||||
import {OrthographicCamera} from "three/src/cameras/OrthographicCamera";
|
||||
import {mdiCrosshairsGps, mdiDownload, mdiGithub, mdiProjector} from '@mdi/js'
|
||||
import {mdiClose, mdiCrosshairsGps, mdiDownload, mdiGithub, mdiLicense, mdiProjector} from '@mdi/js'
|
||||
import SvgIcon from '@jamescoyle/vue-icon/lib/svg-icon.vue';
|
||||
import {SceneMgrRefData} from "../misc/scene";
|
||||
import type {ModelViewerElement} from '@google/model-viewer';
|
||||
import type {Intersection} from "three";
|
||||
import type {MObject3D} from "./Selection.vue";
|
||||
import Selection from "./Selection.vue";
|
||||
import LicensesDialogContent from "./LicensesDialogContent.vue";
|
||||
|
||||
|
||||
let props = defineProps<{ refSData: SceneMgrRefData }>();
|
||||
@@ -77,10 +87,10 @@ async function openGithub() {
|
||||
<orientation-gizmo :scene="props.refSData.viewerScene" v-if="props.refSData.viewerScene !== null"/>
|
||||
<v-divider/>
|
||||
<h5>Camera</h5>
|
||||
<v-btn icon="" @click="toggleProjection"><span class="icon-detail">{{ toggleProjectionText }}</span>
|
||||
<v-btn icon @click="toggleProjection"><span class="icon-detail">{{ toggleProjectionText }}</span>
|
||||
<svg-icon type="mdi" :path="mdiProjector"></svg-icon>
|
||||
</v-btn>
|
||||
<v-btn icon="" @click="centerCamera">
|
||||
<v-btn icon @click="centerCamera">
|
||||
<svg-icon type="mdi" :path="mdiCrosshairsGps"/>
|
||||
</v-btn>
|
||||
<v-divider/>
|
||||
@@ -90,11 +100,37 @@ async function openGithub() {
|
||||
<template #fallback>Loading...</template>
|
||||
</Suspense>
|
||||
<v-divider/>
|
||||
<v-spacer></v-spacer>
|
||||
<h5>Extras</h5>
|
||||
<v-btn icon="" @click="downloadSceneGlb">
|
||||
<v-btn icon @click="downloadSceneGlb">
|
||||
<svg-icon type="mdi" :path="mdiDownload"/>
|
||||
</v-btn>
|
||||
<v-btn icon="" @click="openGithub">
|
||||
<v-dialog id="licenses-dialog" fullscreen>
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-btn icon v-bind="props">
|
||||
<svg-icon type="mdi" :path="mdiLicense"/>
|
||||
</v-btn>
|
||||
</template>
|
||||
<template v-slot:default="{ isActive }">
|
||||
<v-card>
|
||||
<v-toolbar>
|
||||
<v-toolbar-title>Licenses</v-toolbar-title>
|
||||
<v-spacer>
|
||||
</v-spacer>
|
||||
<v-btn icon @click="isActive.value = false">
|
||||
<svg-icon type="mdi" :path="mdiClose"/>
|
||||
</v-btn>
|
||||
</v-toolbar>
|
||||
<v-card-text>
|
||||
<Suspense>
|
||||
<licenses-dialog-content/>
|
||||
<template #fallback>Loading...</template>
|
||||
</Suspense>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
</v-dialog>
|
||||
<v-btn icon @click="openGithub">
|
||||
<svg-icon type="mdi" :path="mdiGithub"/>
|
||||
</v-btn>
|
||||
<!-- TODO: Licenses button -->
|
||||
|
||||
Reference in New Issue
Block a user