From e0b06fe966369fdba9dd767563ab45a3c7ff8c2f Mon Sep 17 00:00:00 2001 From: "R.Piontik" Date: Fri, 11 Aug 2023 09:00:36 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9C=D0=B8=D0=BA=D1=81=D0=B8=D0=BD=20=D0=BF?= =?UTF-8?q?=D0=B5=D1=80=D0=B5=D0=BD=D0=B5=D1=81=D0=B5=D0=BD=20=D0=B2=20?= =?UTF-8?q?=D0=BF=D0=B0=D0=BF=D0=BA=D0=B5=20=D1=81=D1=85=D0=B5=D0=BC.=20?= =?UTF-8?q?=D0=A3=D0=BD=D0=B8=D1=84=D0=B8=D1=86=D0=B8=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=B0=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=20?= =?UTF-8?q?=D0=B7=D1=83=D0=BC=D0=B0=20=D0=B8=20=D0=BF=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D1=82=D0=B0=D1=81=D0=BA=D0=B8=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Schema/DHSchema/DHSchema.vue | 5 +---- src/frontend/components/Schema/PlantUML.vue | 6 +----- .../{mixins => components/Schema}/zoomAndPan.js | 16 ++++++++++------ 3 files changed, 12 insertions(+), 15 deletions(-) rename src/frontend/{mixins => components/Schema}/zoomAndPan.js (87%) diff --git a/src/frontend/components/Schema/DHSchema/DHSchema.vue b/src/frontend/components/Schema/DHSchema/DHSchema.vue index 25238f1c..2b651bbd 100644 --- a/src/frontend/components/Schema/DHSchema/DHSchema.vue +++ b/src/frontend/components/Schema/DHSchema/DHSchema.vue @@ -101,10 +101,7 @@ import SchemaTrack from './DHSchemaTrack.vue'; import SchemaDebugNode from './DHSchemaDebugNode.vue'; - import ZoomAndPan from '@front/mixins/zoomAndPan'; - - // require(process.env.VUE_APP_DOCHUB_SMART_ANTS_SOURCE); - + import ZoomAndPan from '../zoomAndPan'; const Graph = new function() { const codeWorker = require(`!!raw-loader!${process.env.VUE_APP_DOCHUB_SMART_ANTS_SOURCE}`).default; diff --git a/src/frontend/components/Schema/PlantUML.vue b/src/frontend/components/Schema/PlantUML.vue index 535bb017..29a5c2a7 100644 --- a/src/frontend/components/Schema/PlantUML.vue +++ b/src/frontend/components/Schema/PlantUML.vue @@ -16,7 +16,6 @@
({ zoomAndPan: { - zoomKey: 'ctrlKey', // Кнопка для зума - panKey: 'shiftKey', + zoomKeys: ['ctrlKey', 'shiftKey'], // Кнопка для зума + panKeys: ['ctrlKey', 'shiftKey'], isMove: false, // Признак перемещения схемы - isShiftSens: false, // Признак, что пользователь нажал шифт cacheViewBox: null, moveX: 0, moveY: 0, @@ -52,8 +51,14 @@ export default { this.ZoomAndPanViewBox.height += resizeHeight; this.zoomAndPan.cacheViewBox = null; }, + isPushKey(event, keys) { + for (let i = 0; i < keys.length; i++) { + if (event[keys[i]]) return true; + } + return false; + }, zoomAndPanWheelHandler(event) { - if (!event[this.zoomAndPan.zoomKey]) return; + if (!this.isPushKey(event, this.zoomAndPan.zoomKeys)) return; let e = window.event || event; switch (Math.max(-1, Math.min(1, (e.deltaY || -e.detail)))) { case 1: @@ -66,13 +71,12 @@ export default { event.stopPropagation(); }, zoomAndPanMouseDown(event) { - if (!event[this.zoomAndPan.panKey]) return; + if (!this.isPushKey(event, this.zoomAndPan.panKeys)) return; this.zoomAndPan.isMove = true; this.zoomAndPan.moveX = event.clientX; this.zoomAndPan.moveY = event.clientY; }, zoomAndPanMouseMove(event) { - this.zoomAndPan.isShiftSens = event[this.zoomAndPan.panKey]; if (!this.zoomAndPan.isMove) return; this.ZoomAndPanViewBox.x += (this.zoomAndPan.moveX - event.clientX) * (this.koofScreenX || 0); this.ZoomAndPanViewBox.y += (this.zoomAndPan.moveY - event.clientY) * (this.koofScreenY || 0);