Skip to content

Commit

Permalink
fix: 多选下合并图形
Browse files Browse the repository at this point in the history
  • Loading branch information
xuguanjie committed Feb 28, 2024
1 parent 9d02376 commit ce11dfd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Binary file modified packages/cw/cw_drawing_image_view_library/assets/12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,25 @@ export default {
if(e.keyCode===18){
canvas.defaultCursor = "grab"
}
const objs = canvas.getActiveObjects()
if(objs.length){
if(e.keyCode === 40){
objs.forEach(item=>{item.top = item.top + 1})
e.preventDefault();
}else if(e.keyCode === 38){
objs.forEach(item=>{item.top = item.top - 1})
e.preventDefault();
}else if(e.keyCode === 37){
objs.forEach(item=>{item.left = item.left -1})
e.preventDefault();
}else if(e.keyCode === 39){
objs.forEach(item=>{item.left = item.left +1})
e.preventDefault();
}
canvas.requestRenderAll()
}else{
}
});
document.addEventListener("keyup", (e) => {
if(e.keyCode===18){
Expand Down Expand Up @@ -334,8 +353,12 @@ export default {
this.selectedList = e.selected
})
canvas.on('selection:updated', (e) => {
console.log(e);
if(e.selected.length===1&& e.selected[0].group){
// console.log( e.selected[0],222);
this.selectedList = e.selected[0].group._objects
}else{
this.selectedList = e.selected
}
})
canvas.on('selection:cleared', (e) => {
console.log(e);
Expand Down

0 comments on commit ce11dfd

Please sign in to comment.