@zzalai/leafer-point-annotation 1.1.4 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -13
- package/README_EN.md +17 -13
- package/docs/assets/{index-DJUbn3Yd.js → index-B2EnBW5l.js} +1 -1
- package/docs/assets/{index-BICV4seT.css → index-BtyValpk.css} +1 -1
- package/docs/index.html +2 -2
- package/package.json +1 -1
- package/project-docs/ARCHITECTURE.md +2 -0
- package/project-docs/SHARED_UNDO_REDO_STACK.md +503 -0
- package/src/App.vue +6 -3
- package/src/components/PointAnnotation.vue +71 -67
|
@@ -319,6 +319,7 @@ export interface OptionsSource {
|
|
|
319
319
|
zoomMin?: number;
|
|
320
320
|
zoomMax?: number;
|
|
321
321
|
enableBrush?: boolean;
|
|
322
|
+
enableHotkeys?: boolean;
|
|
322
323
|
}
|
|
323
324
|
|
|
324
325
|
const props = defineProps({
|
|
@@ -1028,74 +1029,77 @@ onMounted(() => {
|
|
|
1028
1029
|
window.addEventListener("mousemove", handleMouseMove);
|
|
1029
1030
|
window.addEventListener("focusout", handleFocusOut);
|
|
1030
1031
|
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
event
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
event
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
event
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
event
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
event
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
event
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
event
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
event
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
event
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1032
|
+
// 根据 enableHotkeys 配置决定是否注册热键(默认不启用,显式传 true 才启用)
|
|
1033
|
+
if (props.options.enableHotkeys) {
|
|
1034
|
+
const unsubscribe = tinykeys(window, {
|
|
1035
|
+
v: (event: KeyboardEvent) => {
|
|
1036
|
+
if (!isCanvasFocused.value && !isMouseOverCanvas.value) return;
|
|
1037
|
+
event.preventDefault();
|
|
1038
|
+
selectTool();
|
|
1039
|
+
},
|
|
1040
|
+
p: (event: KeyboardEvent) => {
|
|
1041
|
+
if (!isCanvasFocused.value && !isMouseOverCanvas.value) return;
|
|
1042
|
+
event.preventDefault();
|
|
1043
|
+
pointTool();
|
|
1044
|
+
},
|
|
1045
|
+
b: (event: KeyboardEvent) => {
|
|
1046
|
+
if (!effectiveEnableBrush.value) return;
|
|
1047
|
+
if (!isCanvasFocused.value && !isMouseOverCanvas.value) return;
|
|
1048
|
+
event.preventDefault();
|
|
1049
|
+
brushTool();
|
|
1050
|
+
},
|
|
1051
|
+
e: (event: KeyboardEvent) => {
|
|
1052
|
+
if (!effectiveEnableBrush.value) return;
|
|
1053
|
+
if (!isCanvasFocused.value && !isMouseOverCanvas.value) return;
|
|
1054
|
+
event.preventDefault();
|
|
1055
|
+
eraserTool();
|
|
1056
|
+
},
|
|
1057
|
+
"$mod+KeyZ": (event: KeyboardEvent) => {
|
|
1058
|
+
if (!isCanvasFocused.value && !isMouseOverCanvas.value) return;
|
|
1059
|
+
event.preventDefault();
|
|
1060
|
+
event.stopPropagation();
|
|
1061
|
+
undo();
|
|
1062
|
+
},
|
|
1063
|
+
"$mod+KeyY": (event: KeyboardEvent) => {
|
|
1064
|
+
if (!isCanvasFocused.value && !isMouseOverCanvas.value) return;
|
|
1065
|
+
event.preventDefault();
|
|
1066
|
+
event.stopPropagation();
|
|
1067
|
+
redo();
|
|
1068
|
+
},
|
|
1069
|
+
Delete: (event: KeyboardEvent) => {
|
|
1070
|
+
if (!isCanvasFocused.value && !isMouseOverCanvas.value) return;
|
|
1071
|
+
event.preventDefault();
|
|
1072
|
+
event.stopPropagation();
|
|
1073
|
+
deleteSelected();
|
|
1074
|
+
},
|
|
1075
|
+
"$mod+Equal": (event: KeyboardEvent) => {
|
|
1076
|
+
if (!isCanvasFocused.value && !isMouseOverCanvas.value) return;
|
|
1077
|
+
event.preventDefault();
|
|
1078
|
+
event.stopPropagation();
|
|
1079
|
+
zoomIn();
|
|
1080
|
+
},
|
|
1081
|
+
"$mod+Minus": (event: KeyboardEvent) => {
|
|
1082
|
+
if (!isCanvasFocused.value && !isMouseOverCanvas.value) return;
|
|
1083
|
+
event.preventDefault();
|
|
1084
|
+
event.stopPropagation();
|
|
1085
|
+
zoomOut();
|
|
1086
|
+
},
|
|
1087
|
+
"$mod+0": (event: KeyboardEvent) => {
|
|
1088
|
+
if (!isCanvasFocused.value && !isMouseOverCanvas.value) return;
|
|
1089
|
+
event.preventDefault();
|
|
1090
|
+
event.stopPropagation();
|
|
1091
|
+
resetZoom();
|
|
1092
|
+
},
|
|
1093
|
+
Alt: (event: KeyboardEvent) => {
|
|
1094
|
+
if (!isCanvasFocused.value && !isMouseOverCanvas.value) return;
|
|
1095
|
+
event.preventDefault();
|
|
1096
|
+
showHotkeys.value = !showHotkeys.value;
|
|
1097
|
+
},
|
|
1098
|
+
});
|
|
1096
1099
|
|
|
1097
|
-
|
|
1098
|
-
|
|
1100
|
+
// 🔧 多实例支持:unsubscribe 保存在当前组件作用域,不再使用全局 window 存储
|
|
1101
|
+
hotkeysUnsubscribe = unsubscribe;
|
|
1102
|
+
}
|
|
1099
1103
|
});
|
|
1100
1104
|
});
|
|
1101
1105
|
|