2025-04-10 16:37:20 +08:00
|
|
|
<template>
|
2025-04-14 16:37:17 +08:00
|
|
|
<CfFlex class="material-view">
|
2025-05-08 11:34:35 +08:00
|
|
|
<div ref="container" class="material-view-container" />
|
|
|
|
<MaterialAdjuster ref="adjuster" class="material-view-sider" :texture-src="textureSrc" @cancel="config.cancelCallback" @submit="config.submitCallback" />
|
2025-04-14 16:37:17 +08:00
|
|
|
</CfFlex>
|
2025-04-10 16:37:20 +08:00
|
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
2025-05-08 11:34:35 +08:00
|
|
|
import { onMounted, ref, useTemplateRef } from 'vue';
|
2025-04-14 16:37:17 +08:00
|
|
|
import MaterialAdjuster from './MaterialAdjuster.vue';
|
|
|
|
import { useScene } from '../stores/sceneStore';
|
|
|
|
import CfFlex from './CfFlex.vue';
|
2025-05-08 11:34:35 +08:00
|
|
|
import { GetConfig } from '../lib/libOutputConfig';
|
|
|
|
import { useEvent } from '../stores/eventStore';
|
2025-04-10 16:37:20 +08:00
|
|
|
|
2025-04-14 16:37:17 +08:00
|
|
|
const scene = useScene();
|
2025-05-08 11:34:35 +08:00
|
|
|
const eventbus = useEvent();
|
|
|
|
const container = useTemplateRef('container');
|
|
|
|
const adjusterRef = useTemplateRef('adjuster');
|
|
|
|
const config = GetConfig();
|
|
|
|
const textureSrc = ref(config.textureSrc);
|
2025-04-10 16:37:20 +08:00
|
|
|
|
2025-04-15 09:35:54 +08:00
|
|
|
// 禁用右键菜单
|
|
|
|
document.addEventListener('contextmenu', (e) => e.preventDefault());
|
|
|
|
|
2025-04-10 16:37:20 +08:00
|
|
|
onMounted(() => {
|
2025-04-14 16:37:17 +08:00
|
|
|
scene.Initial(container.value);
|
2025-05-08 11:34:35 +08:00
|
|
|
eventbus.Subscribe('submit', () => adjusterRef.value.Upload());
|
|
|
|
eventbus.Subscribe('update-texture', () => {
|
|
|
|
textureSrc.value = config.textureSrc
|
|
|
|
});
|
2025-04-14 16:37:17 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
2025-05-08 11:34:35 +08:00
|
|
|
<style scoped lang="scss">
|
2025-04-14 16:37:17 +08:00
|
|
|
.material-view
|
|
|
|
{
|
|
|
|
width: 100%;
|
2025-05-08 11:34:35 +08:00
|
|
|
height: 100%;
|
2025-04-14 16:37:17 +08:00
|
|
|
box-sizing: border-box;
|
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
|
|
|
overflow: hidden;
|
2025-05-08 11:34:35 +08:00
|
|
|
|
|
|
|
&-container {
|
|
|
|
flex: 3 1;
|
|
|
|
height: 100%;
|
|
|
|
box-sizing: border-box;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
&-sider {
|
|
|
|
flex: 1 1;
|
|
|
|
overflow-y: auto;
|
|
|
|
height: 100%;
|
|
|
|
box-sizing: border-box;
|
|
|
|
}
|
2025-04-10 16:37:20 +08:00
|
|
|
}
|
2025-04-14 16:37:17 +08:00
|
|
|
</style>
|