|
|
@@ -88,7 +88,8 @@ import {
|
|
|
rotatePoint,
|
|
|
getRectCoordinate,
|
|
|
getRectCenterCoordinate,
|
|
|
- handleAlign
|
|
|
+ handleAlign,
|
|
|
+ isSystemShortcutKey
|
|
|
} from '@/components/mt-edit/utils'
|
|
|
import type {
|
|
|
AdsorbPointType,
|
|
|
@@ -300,14 +301,15 @@ const onRenderCoreMouseDown = (item: IDoneJson, e: MouseEvent) => {
|
|
|
})
|
|
|
cacheStore.setBoundingBox(allBoundingInfo)
|
|
|
}
|
|
|
- if (!e.ctrlKey) {
|
|
|
+ const system_shortcut_pressed = isSystemShortcutKey(e)
|
|
|
+ if (!system_shortcut_pressed) {
|
|
|
// 如果当前id已经是选中状态了 则不需要取消其它组件的激活状态 也不需要重复设置选中状态
|
|
|
if (globalStore.selected_items_id.includes(item.id)) {
|
|
|
return
|
|
|
}
|
|
|
//将除了选中id的图形全部设置为非选中
|
|
|
globalStore.setSingleSelect(item.id)
|
|
|
- } else if (e.ctrlKey && !item.lock) {
|
|
|
+ } else if (system_shortcut_pressed && !item.lock) {
|
|
|
const find_item = globalStore.done_json.find((f) => f.id == item.id)!
|
|
|
find_item.active = !find_item.active
|
|
|
globalStore.refreshSelectedItemsId()
|
|
|
@@ -1033,18 +1035,19 @@ const onContextMenuClick = (key: ContextMenuInfoType, e: MouseEvent) => {
|
|
|
globalStore.setIntention('none')
|
|
|
}
|
|
|
const onKeydown = (e: KeyboardEvent) => {
|
|
|
+ const system_shortcut_pressed = isSystemShortcutKey(e)
|
|
|
// 全选
|
|
|
- if (e.ctrlKey && e.key.toLocaleLowerCase() === 'a') {
|
|
|
+ if (system_shortcut_pressed && e.key.toLocaleLowerCase() === 'a') {
|
|
|
e.preventDefault()
|
|
|
onContextMenuSelectAll()
|
|
|
}
|
|
|
//复制
|
|
|
- else if (e.ctrlKey && e.key.toLocaleLowerCase() === 'c') {
|
|
|
+ else if (system_shortcut_pressed && e.key.toLocaleLowerCase() === 'c') {
|
|
|
e.preventDefault()
|
|
|
onContextMenuCopy()
|
|
|
}
|
|
|
//粘贴
|
|
|
- else if (e.ctrlKey && e.key.toLocaleLowerCase() === 'v') {
|
|
|
+ else if (system_shortcut_pressed && e.key.toLocaleLowerCase() === 'v') {
|
|
|
e.preventDefault()
|
|
|
onContextMenuPaste(10, 10)
|
|
|
}
|
|
|
@@ -1054,42 +1057,42 @@ const onKeydown = (e: KeyboardEvent) => {
|
|
|
onContextMenuDelete()
|
|
|
}
|
|
|
//组合
|
|
|
- else if (e.ctrlKey && e.key.toLocaleLowerCase() === 'g') {
|
|
|
+ else if (system_shortcut_pressed && e.key.toLocaleLowerCase() === 'g') {
|
|
|
e.preventDefault()
|
|
|
onContextMenuGroup()
|
|
|
}
|
|
|
//取消组合
|
|
|
- else if (e.ctrlKey && e.key.toLocaleLowerCase() === 'u') {
|
|
|
+ else if (system_shortcut_pressed && e.key.toLocaleLowerCase() === 'u') {
|
|
|
e.preventDefault()
|
|
|
onContextMenuUnGroup()
|
|
|
}
|
|
|
// 置顶
|
|
|
- else if (e.ctrlKey && e.key === 'ArrowRight') {
|
|
|
+ else if (system_shortcut_pressed && e.key === 'ArrowRight') {
|
|
|
e.preventDefault()
|
|
|
onContextMoveTop()
|
|
|
}
|
|
|
// 置底
|
|
|
- else if (e.ctrlKey && e.key === 'ArrowLeft') {
|
|
|
+ else if (system_shortcut_pressed && e.key === 'ArrowLeft') {
|
|
|
e.preventDefault()
|
|
|
onContextMoveBottom()
|
|
|
}
|
|
|
// 上移一层
|
|
|
- else if (e.ctrlKey && e.key === 'ArrowUp') {
|
|
|
+ else if (system_shortcut_pressed && e.key === 'ArrowUp') {
|
|
|
e.preventDefault()
|
|
|
onContextMoveUp()
|
|
|
}
|
|
|
// 下移一层
|
|
|
- else if (e.ctrlKey && e.key === 'ArrowDown') {
|
|
|
+ else if (system_shortcut_pressed && e.key === 'ArrowDown') {
|
|
|
e.preventDefault()
|
|
|
onContextMoveDown()
|
|
|
}
|
|
|
// 撤销
|
|
|
- else if (e.ctrlKey && e.key.toLocaleLowerCase() === 'z') {
|
|
|
+ else if (system_shortcut_pressed && e.key.toLocaleLowerCase() === 'z') {
|
|
|
e.preventDefault()
|
|
|
onUndo()
|
|
|
}
|
|
|
// 重做
|
|
|
- else if (e.ctrlKey && e.key.toLocaleLowerCase() === 'y') {
|
|
|
+ else if (system_shortcut_pressed && e.key.toLocaleLowerCase() === 'y') {
|
|
|
e.preventDefault()
|
|
|
onRedo()
|
|
|
}
|
|
|
@@ -1150,7 +1153,7 @@ const onKeydown = (e: KeyboardEvent) => {
|
|
|
}
|
|
|
}
|
|
|
const onMouseWheel = (e: any) => {
|
|
|
- if (e.ctrlKey) {
|
|
|
+ if (isSystemShortcutKey(e)) {
|
|
|
e.preventDefault()
|
|
|
e.stopPropagation()
|
|
|
if (e.deltaY > 0) {
|