Merge branch 'main' of ssh://18.167.251.121:10002/aidlab/FiDA_Front
This commit is contained in:
@@ -183,11 +183,8 @@
|
|||||||
if (!activeLayerId.value) return
|
if (!activeLayerId.value) return
|
||||||
layerManager.deleteLayerById(activeLayerId.value)
|
layerManager.deleteLayerById(activeLayerId.value)
|
||||||
}
|
}
|
||||||
const onWorkbench = async () => {
|
const onWorkbench = () => {
|
||||||
exportCanvasToImage(canvasManager.canvas).then((url) => {
|
emit('workbench')
|
||||||
const { canvas, images } = canvasManager.getCanvasDisUrlJSON()
|
|
||||||
emit('workbench', { url, canvas, images })
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<details-panel />
|
<details-panel />
|
||||||
<brush-control-panel :currentTool="toolManager.currentTool.value" />
|
<brush-control-panel :currentTool="toolManager.currentTool.value" />
|
||||||
<ai-selectbox-panel :currentTool="toolManager.currentTool.value" />
|
<ai-selectbox-panel :currentTool="toolManager.currentTool.value" />
|
||||||
<depth-header-tools @export="exportCanvas" @workbench="(v) => emit('workbench', v)" />
|
<depth-header-tools @export="exportCanvas" @workbench="onWorkbench" />
|
||||||
|
|
||||||
<zoom
|
<zoom
|
||||||
:zoom="canvasManager.currentZoom.value / 100"
|
:zoom="canvasManager.currentZoom.value / 100"
|
||||||
@@ -52,6 +52,12 @@
|
|||||||
default: () => ({})
|
default: () => ({})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
const onWorkbench = async () => {
|
||||||
|
exportCanvasToImage(canvasManager.canvas).then((url) => {
|
||||||
|
const { canvas, images } = canvasManager.getCanvasDisUrlJSON()
|
||||||
|
emit('workbench', { url, canvas, images })
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 准备就绪
|
// 准备就绪
|
||||||
const isReady = ref(false)
|
const isReady = ref(false)
|
||||||
@@ -78,7 +84,7 @@
|
|||||||
provide('toolManager', toolManager)
|
provide('toolManager', toolManager)
|
||||||
|
|
||||||
//键盘事件管理器
|
//键盘事件管理器
|
||||||
const keyEventManager = new KeyEventManager({ stateManager })
|
const keyEventManager = new KeyEventManager({ stateManager, onWorkbench })
|
||||||
stateManager.setManager({ keyEventManager })
|
stateManager.setManager({ keyEventManager })
|
||||||
provide('keyEventManager', keyEventManager)
|
provide('keyEventManager', keyEventManager)
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,12 @@ fabric.Object.prototype.toObject = function () {
|
|||||||
arr.push(...v)
|
arr.push(...v)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
if (this.fill?.source === null) {
|
||||||
|
let image = new Image()
|
||||||
|
image.crossOrigin = 'anonymous'
|
||||||
|
image.src = this.info?.fill?.source
|
||||||
|
this.fill.source = image
|
||||||
|
}
|
||||||
const object = this.toObject_(arr)
|
const object = this.toObject_(arr)
|
||||||
if (object.info) {
|
if (object.info) {
|
||||||
let lock = !!object.info.lock
|
let lock = !!object.info.lock
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
export class KeyEventManager {
|
export class KeyEventManager {
|
||||||
stateManager: any
|
stateManager: any
|
||||||
|
onWorkbench: any
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
this.stateManager = options.stateManager;
|
this.stateManager = options.stateManager;
|
||||||
|
this.onWorkbench = options.onWorkbench;
|
||||||
this._handleKeyDown = this.handleKeyDown.bind(this)
|
this._handleKeyDown = this.handleKeyDown.bind(this)
|
||||||
}
|
}
|
||||||
onMounted() { }
|
onMounted() { }
|
||||||
@@ -9,6 +11,7 @@ export class KeyEventManager {
|
|||||||
/** 处理键盘事件 */
|
/** 处理键盘事件 */
|
||||||
_handleKeyDown: any
|
_handleKeyDown: any
|
||||||
handleKeyDown(event: any) {
|
handleKeyDown(event: any) {
|
||||||
|
event.preventDefault()
|
||||||
const activeID = this.stateManager.layerManager.activeID.value
|
const activeID = this.stateManager.layerManager.activeID.value
|
||||||
const ctrl = event.ctrlKey ? 'ctrl-' : "";
|
const ctrl = event.ctrlKey ? 'ctrl-' : "";
|
||||||
const shift = event.shiftKey ? 'shift-' : "";
|
const shift = event.shiftKey ? 'shift-' : "";
|
||||||
@@ -18,6 +21,7 @@ export class KeyEventManager {
|
|||||||
{ key: "ctrl-c", handler: () => this.stateManager.layerManager.copyLayerById(activeID) },
|
{ key: "ctrl-c", handler: () => this.stateManager.layerManager.copyLayerById(activeID) },
|
||||||
{ key: "delete", handler: () => this.stateManager.layerManager.deleteLayerById(activeID) },
|
{ key: "delete", handler: () => this.stateManager.layerManager.deleteLayerById(activeID) },
|
||||||
{ key: "ctrl-z", handler: () => this.stateManager.undoState() },
|
{ key: "ctrl-z", handler: () => this.stateManager.undoState() },
|
||||||
|
{ key: "ctrl-s", handler: () => this.onWorkbench() },
|
||||||
{ key: "ctrl-shift-z", handler: () => this.stateManager.redoState() },
|
{ key: "ctrl-shift-z", handler: () => this.stateManager.redoState() },
|
||||||
]
|
]
|
||||||
list.forEach((v: any) => {
|
list.forEach((v: any) => {
|
||||||
|
|||||||
@@ -122,7 +122,7 @@
|
|||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
)
|
)
|
||||||
const menus = ref([
|
const menus = ref([
|
||||||
{ label: 'Copy', tip: 'Ctrl+C', on: () => emit('copy-node', clickTaskId.value) },
|
{ label: 'Copy', tip: 'Ctrl+C', on: () => emit('copy-node') },
|
||||||
{
|
{
|
||||||
label: 'Delete',
|
label: 'Delete',
|
||||||
tip: 'Del',
|
tip: 'Del',
|
||||||
@@ -228,6 +228,7 @@
|
|||||||
...options,
|
...options,
|
||||||
}
|
}
|
||||||
depthCanvasWorkbench(workbenchData)
|
depthCanvasWorkbench(workbenchData)
|
||||||
|
depthCanvasClose()
|
||||||
},
|
},
|
||||||
onClose:depthCanvasClose
|
onClose:depthCanvasClose
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
:data="node.data.data"
|
:data="node.data.data"
|
||||||
v-bind="node.data"
|
v-bind="node.data"
|
||||||
@delete-node="deleteNode(node.id)"
|
@delete-node="deleteNode(node.id)"
|
||||||
@copy-node="copyNode($event, node.id)"
|
@copy-node="copyNode(node.id)"
|
||||||
@update-data="(v) => (node.data.data = v)"
|
@update-data="(v) => (node.data.data = v)"
|
||||||
@bring-to-font="bringToFont(node.id)"
|
@bring-to-font="bringToFont(node.id)"
|
||||||
@send-to-back="sendToBack(node.id)"
|
@send-to-back="sendToBack(node.id)"
|
||||||
@@ -179,8 +179,8 @@
|
|||||||
nodeManager.deleteNode(id)
|
nodeManager.deleteNode(id)
|
||||||
}
|
}
|
||||||
/** 复制节点 */
|
/** 复制节点 */
|
||||||
const copyNode = (clickTaskId, id) => {
|
const copyNode = (id) => {
|
||||||
nodeManager.copyNodeById(clickTaskId, id)
|
nodeManager.copyNodeById(id)
|
||||||
}
|
}
|
||||||
/** 节点zIndex设置最大 */
|
/** 节点zIndex设置最大 */
|
||||||
const bringToFont = (id) => {
|
const bringToFont = (id) => {
|
||||||
|
|||||||
@@ -139,10 +139,9 @@ export class NodeManager {
|
|||||||
return this.createNode(options_)
|
return this.createNode(options_)
|
||||||
}
|
}
|
||||||
|
|
||||||
copyNodeById(clickTaskId:string, id: string) {
|
copyNodeById(id: string) {
|
||||||
const node = this.stateManager.getNodeById(id)
|
const node = this.stateManager.getNodeById(id)
|
||||||
let copyNode = JSON.parse(JSON.stringify(node))
|
let copyNode = JSON.parse(JSON.stringify(node))
|
||||||
copyNode.data.data.imageProcessTasks = copyNode.data.data.imageProcessTasks.filter((item:any)=>item.taskId == clickTaskId)
|
|
||||||
const flowNode = this.stateManager.flowManager.getNodeById(id)
|
const flowNode = this.stateManager.flowManager.getNodeById(id)
|
||||||
if (!node) return console.warn(`${id}找不到对应节点`)
|
if (!node) return console.warn(`${id}找不到对应节点`)
|
||||||
if (node.data?.disableCopy) return console.warn(`${id}节点已禁用复制`)
|
if (node.data?.disableCopy) return console.warn(`${id}节点已禁用复制`)
|
||||||
@@ -156,6 +155,9 @@ export class NodeManager {
|
|||||||
}
|
}
|
||||||
delete node_.data?.superiorID
|
delete node_.data?.superiorID
|
||||||
delete node_.data?.disableDelete
|
delete node_.data?.disableDelete
|
||||||
|
node_.data.data.imageProcessTasks.forEach((item) => {
|
||||||
|
item.canvasId = null
|
||||||
|
})
|
||||||
this.stateManager.addNode(node_)
|
this.stateManager.addNode(node_)
|
||||||
}
|
}
|
||||||
dispose() {}
|
dispose() {}
|
||||||
|
|||||||
Reference in New Issue
Block a user