深度画布拖拽图层bug

This commit is contained in:
lzp
2026-03-31 17:10:25 +08:00
parent 757f1bda72
commit 8ae9c02206
2 changed files with 6 additions and 4 deletions

View File

@@ -69,6 +69,7 @@
const draging = ref(false)
const layerManager = inject('layerManager') as any
const canvasManager = inject('canvasManager') as any
const stateManager = inject('stateManager') as any
const list = computed(() => layerManager.layers.value)
const config = ref({
'data-container-type': 'root',
@@ -112,7 +113,7 @@
clearData()
layerManager.sortLayers(true)
}
const handleAdd = (event, parent?) => {
const handleAdd = async (event, parent?) => {
const { from, to, oldIndex, newIndex, data } = event
if (data.type === 'group') return
console.log('跨级拖动', startParent.value, oldIndex, parent, newIndex)
@@ -126,7 +127,9 @@
}
arr.splice(newIndex, 0, layer)
clearData()
layerManager.sortLayers(true)
layerManager.sortLayers(false)
await layerManager.updateLayerThumbnailsById(layer.info.id)
stateManager.recordState()
}
const addLayer = () => {
layerManager.createEmptyLayer(true, true)

View File

@@ -190,8 +190,7 @@ export class CanvasManager {
for (let i = 0; i < objects.length; i++) {
let object = objects[i]
let path = this.getObjectById(object.info.parentId)?.clipPath
if (!path) continue
object.set({ clipPath: path })
object.set({ clipPath: path || null })
}
this.renderAll()
}