Michael Wang 3 anni fa
parent
commit
23798c0f59
1 ha cambiato i file con 15 aggiunte e 1 eliminazioni
  1. 15 1
      src/components/ZoomPaper.vue

+ 15 - 1
src/components/ZoomPaper.vue

@@ -33,7 +33,7 @@ import {
   ZoomOutOutlined,
   FullscreenOutlined,
 } from "@ant-design/icons-vue";
-import { computed } from "vue";
+import { computed, onMounted, onUnmounted } from "vue";
 import { store } from "@/store/store";
 
 const upScale = () => {
@@ -55,6 +55,20 @@ const greaterThanOneScale = computed(() => {
 const lessThanOneScale = computed(() => {
   return store.setting.uiSetting["answer.paper.scale"] < 1;
 });
+
+function keyListener(event: KeyboardEvent) {
+  if (event.key === "+") {
+    upScale();
+  } else if (event.key === "-") {
+    downScale();
+  }
+}
+onMounted(() => {
+  document.addEventListener("keydown", keyListener);
+});
+onUnmounted(() => {
+  document.removeEventListener("keydown", keyListener);
+});
 </script>
 
 <style scoped>