添加编辑模式
This commit is contained in:
@@ -11,6 +11,7 @@ import { useScene } from '../stores/sceneStore';
|
||||
import CfFlex from './CfFlex.vue';
|
||||
import { GetConfig } from '../lib/libOutputConfig';
|
||||
import { useEvent } from '../stores/eventStore';
|
||||
import { FromDeflateBase64 } from '../helpers/helper.material';
|
||||
|
||||
const scene = useScene();
|
||||
const eventbus = useEvent();
|
||||
@@ -21,10 +22,13 @@ const textureSrc = ref(config.textureSrc);
|
||||
|
||||
// 禁用右键菜单
|
||||
document.addEventListener('contextmenu', (e) => e.preventDefault());
|
||||
onMounted(() => {
|
||||
onMounted(async () => {
|
||||
scene.Initial(container.value);
|
||||
await HandleUpdateConfig();
|
||||
|
||||
eventbus.Subscribe('submit', HandleUpload);
|
||||
eventbus.Subscribe('update-texture', HandleChangeTexture);
|
||||
eventbus.Subscribe('update-config', HandleUpdateConfig)
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
@@ -41,6 +45,15 @@ function HandleChangeTexture() {
|
||||
textureSrc.value = config.textureSrc;
|
||||
}
|
||||
|
||||
async function HandleUpdateConfig() {
|
||||
if (config.file && config.file.length > 0) {
|
||||
console.log("base64", config.file);
|
||||
const json = FromDeflateBase64(config.file);
|
||||
await scene.ImportMaterialAsync(json);
|
||||
}
|
||||
textureSrc.value = config.textureSrc;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
Reference in New Issue
Block a user