diff --git a/src/enums/editPageEnum.ts b/src/enums/editPageEnum.ts
index bfb51ef0..4b26802d 100644
--- a/src/enums/editPageEnum.ts
+++ b/src/enums/editPageEnum.ts
@@ -67,7 +67,8 @@ export enum WinKeyboard {
ALT = ' alt',
CTRL_SOURCE_KEY = 'control',
SHIFT_SOURCE_KEY = 'shift',
- ALT_SOURCE_KEY = 'alt'
+ ALT_SOURCE_KEY = 'alt',
+ SPACE = 'Space'
}
// Mac 键盘枚举
diff --git a/src/utils/utils.ts b/src/utils/utils.ts
index 6d56e05c..b587d854 100644
--- a/src/utils/utils.ts
+++ b/src/utils/utils.ts
@@ -273,15 +273,21 @@ export const objToCookie = (obj: RequestParamsObjType) => {
* @returns
*/
export const setKeyboardDressShow = (keyCode?: number) => {
- const code = new Map([[17, WinKeyboard.CTRL]])
+ const code = new Map([
+ [17, WinKeyboard.CTRL],
+ [32, WinKeyboard.SPACE]
+ ])
const dom = document.getElementById('keyboard-dress-show')
if (!dom) return
if (!keyCode) {
+ window.onKeySpacePressHold?.(false)
dom.innerText = ''
return
}
if (keyCode && code.has(keyCode)) {
+ window.onKeySpacePressHold?.(true)
dom.innerText = `按下了「${code.get(keyCode)}」键`
}
}
+
diff --git a/src/views/chart/ContentBox/index.vue b/src/views/chart/ContentBox/index.vue
index 826bbb85..8f7b5e5d 100644
--- a/src/views/chart/ContentBox/index.vue
+++ b/src/views/chart/ContentBox/index.vue
@@ -18,14 +18,14 @@
-
-
+
+
+
+
+
@@ -83,7 +83,11 @@ defineProps({
xScroll: {
type: Boolean,
default: false
- }
+ },
+ disabledScroll: {
+ type: Boolean,
+ default: false
+ },
})
const backHandle = () => {
@@ -93,41 +97,52 @@ const backHandle = () => {
\ No newline at end of file
diff --git a/src/views/chart/ContentEdit/index.vue b/src/views/chart/ContentEdit/index.vue
index 520a558c..f43d426f 100644
--- a/src/views/chart/ContentEdit/index.vue
+++ b/src/views/chart/ContentEdit/index.vue
@@ -1,71 +1,43 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
+ }">
+
+
+
+
-
-
-
-
+ }" :item="item" @click="mouseClickHandle($event, item)" @mousedown="mousedownHandle($event, item)"
+ @mouseenter="mouseenterHandle($event, item)" @mouseleave="mouseleaveHandle($event, item)"
+ @contextmenu="handleContextMenu($event, item, optionsHandle)">
+
+
+
-
-
-
+
+
+
@@ -97,7 +69,8 @@ import { useComponentStyle, useSizeStyle } from './hooks/useStyle.hook'
import { ContentBox } from '../ContentBox/index'
import { EditGroup } from './components/EditGroup'
import { EditRange } from './components/EditRange'
-import { EditRule } from './components/EditRule'
+// import { EditRule } from './components/EditRule'
+import Ruler from './components/EditRule/ruler.vue'
import { EditBottom } from './components/EditBottom'
import { EditShapeBox } from './components/EditShapeBox'
import { EditTools } from './components/EditTools'
@@ -185,12 +158,14 @@ onMounted(() => {
overflow: hidden;
@extend .go-point-bg;
@include background-image('background-point');
+
@include goId('chart-edit-content') {
border-radius: 10px;
margin: 25px;
overflow: hidden;
@extend .go-transition;
@include fetch-theme('box-shadow');
+
.edit-content-chart {
position: absolute;
overflow: hidden;
diff --git a/src/views/chart/hooks/useKeyboard.hook.ts b/src/views/chart/hooks/useKeyboard.hook.ts
index fce80e5e..c8a79685 100644
--- a/src/views/chart/hooks/useKeyboard.hook.ts
+++ b/src/views/chart/hooks/useKeyboard.hook.ts
@@ -110,21 +110,33 @@ const macKeyList: Array = [
const keyRecordHandle = () => {
// 默认赋值
window.$KeyboardActive = {
- ctrl: false
+ ctrl: false,
+ space: false
}
-
+
document.onkeydown = (e: KeyboardEvent) => {
- if(e.keyCode === 17 && window.$KeyboardActive) {
+ const { keyCode } = e
+ if (keyCode == 32 && e.target == document.body) e.preventDefault()
+
+ if ([17, 32].includes(keyCode) && window.$KeyboardActive) {
setKeyboardDressShow(e.keyCode)
- window.$KeyboardActive.ctrl = true
+ switch (keyCode) {
+ case 17: window.$KeyboardActive.ctrl = true; break
+ case 32: window.$KeyboardActive.space = true; break
+ }
}
}
document.onkeyup = (e: KeyboardEvent) => {
- if(e.keyCode === 17 && window.$KeyboardActive)
- {
- window.$KeyboardActive.ctrl = false
+ const { keyCode } = e
+ if (keyCode == 32 && e.target == document.body) e.preventDefault()
+
+ if ([17, 32].includes(keyCode) && window.$KeyboardActive) {
setKeyboardDressShow()
+ switch (keyCode) {
+ case 17: window.$KeyboardActive.ctrl = false; break
+ case 32: window.$KeyboardActive.space = false; break
+ }
}
}
}
diff --git a/types/global.d.ts b/types/global.d.ts
index 1b11026a..aabfe766 100644
--- a/types/global.d.ts
+++ b/types/global.d.ts
@@ -7,6 +7,8 @@ interface Window {
$vue: any
// 键盘按键记录
$KeyboardActive?: { [T: string]: boolean }
+ onKeySpacePressHold?: Function
+
// 编辑 JSON 的存储对象
opener: any
}
diff --git a/types/shims-vue.d.ts b/types/shims-vue.d.ts
index b30c986d..fbfc8922 100644
--- a/types/shims-vue.d.ts
+++ b/types/shims-vue.d.ts
@@ -4,4 +4,5 @@ declare module '*.vue' {
export default component
}
-declare module 'lodash/*'
\ No newline at end of file
+declare module 'lodash/*'
+declare module 'dom-helpers'
\ No newline at end of file