深度画布返回保存

This commit is contained in:
lzp
2026-03-30 16:59:13 +08:00
parent 1789792067
commit 8a88e0dd1d
6 changed files with 29 additions and 8 deletions

View File

@@ -1,5 +1,5 @@
# VITE_APP_URL = http://192.168.31.82:8771 # VITE_APP_URL = http://192.168.31.82:8771
VITE_APP_URL = http://18.167.251.121:10015 VITE_APP_URL = http://18.167.251.121:10015
# VITE_APP_URL = http://192.168.31.118:8080 # VITE_APP_URL = http://192.168.31.118:8080
# VITE_APP_URL = http://192.168.31.82:8755 VITE_APP_URL = http://192.168.31.82:8755
VITE_GOOGLE_CLIENT_ID = 216037134725-7q8vqp0ohtmohlosltkfg7bd2v29rm5a.apps.googleusercontent.com VITE_GOOGLE_CLIENT_ID = 216037134725-7q8vqp0ohtmohlosltkfg7bd2v29rm5a.apps.googleusercontent.com

View File

@@ -38,10 +38,10 @@
<button class="export" @click="emit('import-local')"> <button class="export" @click="emit('import-local')">
<span class="text">本地导入</span> <span class="text">本地导入</span>
</button> --> </button> -->
<button class="workbench" @click="onWorkbench"> <!-- <button class="workbench" @click="onWorkbench">
<span class="icon"><svg-icon name="dc-workbench" size="20" /></span> <span class="icon"><svg-icon name="dc-workbench" size="20" /></span>
<span class="text">{{ $t('DepthCanvas.save') }}</span> <span class="text">{{ $t('DepthCanvas.save') }}</span>
</button> </button> -->
</div> </div>
</template> </template>

View File

@@ -189,6 +189,10 @@
// const canvas = canvasManager.processCanvasDisUrlJSON(object) // const canvas = canvasManager.processCanvasDisUrlJSON(object)
// console.log(canvas) // console.log(canvas)
} }
defineExpose({
onWorkbench
})
</script> </script>
<style lang="less"> <style lang="less">
@import '@vue-flow/core/dist/style.css'; @import '@vue-flow/core/dist/style.css';

View File

@@ -1,7 +1,7 @@
<template> <template>
<fullscreen-dialog v-model="dialogVisible" @close="onClose" hide-destroy> <fullscreen-dialog v-model="dialogVisible" @close="onClose" hide-destroy>
<div class="canvas-box"> <div class="canvas-box">
<depth-canvas :config="config" @workbench="onWorkbench" /> <depth-canvas ref="depthCanvasRef" :config="config" @workbench="onWorkbench" />
</div> </div>
</fullscreen-dialog> </fullscreen-dialog>
</template> </template>
@@ -22,6 +22,7 @@
onWorkbench(options) {}, onWorkbench(options) {},
onClose() {} onClose() {}
}) })
const depthCanvasRef = ref(null)
const open = async (options) => { const open = async (options) => {
config.value = options config.value = options
@@ -61,8 +62,9 @@
} }
// 关闭 // 关闭
const onClose = () => { const onClose = () => {
dialogVisible.value = false depthCanvasRef.value.onWorkbench()
config.value.onClose?.() // dialogVisible.value = false
// config.value.onClose?.()
} }
defineExpose({ defineExpose({

View File

@@ -100,6 +100,7 @@ export class AISelectboxToolManager {
this.demoObject = null this.demoObject = null
} }
createIndicatorObject() { createIndicatorObject() {
this.clearIndicatorObject()
const rect = new fabric.Rect({ const rect = new fabric.Rect({
left: this.startX, left: this.startX,
top: this.startY, top: this.startY,
@@ -198,8 +199,8 @@ export class AISelectboxToolManager {
if (!this.isDragging) return; if (!this.isDragging) return;
this.isDragging = false; this.isDragging = false;
const object = this.indicatorObject.toJSON("evented") const object = this.indicatorObject.toJSON("evented")
if (object.width === 0) object.width = 100 // if (object.width === 0) object.width = 100
if (object.height === 0) object.height = 100 // if (object.height === 0) object.height = 100
this.clearIndicatorObject() this.clearIndicatorObject()
this.canvasManager.canvas.renderAll() this.canvasManager.canvas.renderAll()

View File

@@ -153,6 +153,7 @@ export class CanvasManager {
this.canvas.add(obj) this.canvas.add(obj)
const id = obj?.info?.id || "" const id = obj?.info?.id || ""
if (id) { if (id) {
this.sortActiveObject(obj)
await this.layerManager.updateLayers(!!obj.info.parentId) await this.layerManager.updateLayers(!!obj.info.parentId)
this.renderAll() this.renderAll()
await this.layerManager.updateLayerThumbnailsById(id) await this.layerManager.updateLayerThumbnailsById(id)
@@ -167,6 +168,19 @@ export class CanvasManager {
this.renderAll() this.renderAll()
} }
} }
/** 根据激活对象排序当前对象 */
async sortActiveObject(object: any) {
const activeID = this.layerManager.activeID.value;
if (!activeID) return
const activeObject = this.getObjectById(activeID)
if (!activeObject) return
const parentId = activeObject.info?.parentId
if (!object.info.parentId) object.info.parentId = parentId
const index = this.getObjects().indexOf(activeObject)
this.canvas.moveTo(object, index + 1)
// await this.sortObjectByIds(ids, isRecord)
}
/** 更新子图层裁剪区域 */ /** 更新子图层裁剪区域 */
async updateSubLayerClipPath() { async updateSubLayerClipPath() {