From 8a1b28020e0cdddf4adcd6db38d01c1bcf2f6348 Mon Sep 17 00:00:00 2001 From: = Date: Fri, 12 Jun 2020 09:51:30 +0200 Subject: [PATCH] pan & zoom su riscaldi --- .../base-components/riscaldi-superiori.vue | 8 ++++ .../components/base-components/warmers.ts | 37 +++---------------- .../components/base-components/warmers.vue | 2 +- 3 files changed, 15 insertions(+), 32 deletions(-) diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/riscaldi-superiori.vue b/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/riscaldi-superiori.vue index a0ee9588..146a1727 100644 --- a/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/riscaldi-superiori.vue +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/riscaldi-superiori.vue @@ -67,6 +67,14 @@
+
+ + +
diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/warmers.ts b/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/warmers.ts index 7d74c6d8..14ba365d 100644 --- a/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/warmers.ts +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/warmers.ts @@ -54,48 +54,23 @@ export default class Warmers extends Vue { return result; } - maxWidth: number = 0; - maxHeight: number = 0; - currentViewBoxX: number = 0; - currentViewBoxY: number = 0; - currentZoomX: number = 0; - currentZoomY: number = 0; - - - calcSizes() { - this.maxWidth = Math.max(...this.rows.map(r => this.resistancesPerRow(r).reduce((p, c) => p + c.dimension, 0))) * this.width; - this.maxHeight = this.rows.length * this.height; - - this.currentViewBoxX = this.maxWidth / 2; - this.currentViewBoxY = this.maxHeight / 2; - - this.currentZoomX = this.maxWidth / 2; - this.currentZoomY = this.maxHeight / 2; - } - - get viewBox() { - return [this.currentViewBoxX - this.currentZoomX, this.currentViewBoxY - this.currentZoomY, - this.currentZoomX * 2, this.currentZoomY * 2]; - } + zoomController: any = null; zoomIn() { - this.currentZoomY /= 2; - this.currentZoomX /= 2; + this.zoomController?.zoomIn(); } zoomOut() { - this.currentZoomY *= 2; - this.currentZoomX *= 2; + this.zoomController?.zoomOut(); } - mounted() { - this.calcSizes(); + let $this = this; setTimeout(() => { - svgPanZoom('#warmer', { + $this.zoomController = svgPanZoom('#warmer', { zoomEnabled: true, - controlIconsEnabled: true, + controlIconsEnabled: false, fit: true, center: true, }); diff --git a/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/warmers.vue b/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/warmers.vue index 31a681f8..3700788c 100644 --- a/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/warmers.vue +++ b/Thermo.Active/wwwroot/src/app_modules_thermo/setup/riscaldi/components/base-components/warmers.vue @@ -1,5 +1,5 @@