From e499960a4f186f1a526899ee985ce0b48ba69fac Mon Sep 17 00:00:00 2001
From: lohir <3399054449@qq.com>
Date: 星期二, 22 十月 2024 17:33:40 +0800
Subject: [PATCH] 完成运维考核-工单白名单-列表展示
---
src/views/screen/components/screen-map-three/experience/utils/sizes.js | 44 +++++++++++++++++++++++---------------------
1 files changed, 23 insertions(+), 21 deletions(-)
diff --git a/src/views/screen/components/screen-map-three/experience/utils/sizes.js b/src/views/screen/components/screen-map-three/experience/utils/sizes.js
index af7c98d..2c3aa9b 100644
--- a/src/views/screen/components/screen-map-three/experience/utils/sizes.js
+++ b/src/views/screen/components/screen-map-three/experience/utils/sizes.js
@@ -3,31 +3,33 @@
*/
import EventEmitter from './eventEmitter';
export default class Sizes extends EventEmitter {
- constructor() {
+ constructor(canvas) {
super();
- this.width = document.body.clientWidth;
- this.height = document.body.clientHeight;
- this.device = document.body.clientWidth <= 968 ? 'mobile' : 'pc';
- // 璁惧鍍忕礌
+ this.container = document.querySelector('.map-container');
this.pixelRatio = Math.min(window.devicePixelRatio, 2);
+ this.width = this.container.offsetWidth;
+ this.height = this.container.offsetHeight;
+ this.device = document.body.clientWidth <= 968 ? 'mobile' : 'pc';
+ // this.resizeObserver = new ResizeObserver(entries => {
+ // let rect = canvas.getBoundingClientRect();
+ // this.scaleX = rect.width / this.width;
+ // this.scaleY = rect.height / this.height;
+ // console.log(this.scaleX, this.scaleY);
+ // })
+ // this.resizeObserver.observe(this.container);
// 瀹介珮鍙樺寲
- window.addEventListener('resize', () => {
- // this.width = window.innerWidth;
- // this.height = window.innerHeight;
+ // window.addEventListener('resize', () => {
+ // this.pixelRatio = Math.min(window.devicePixelRatio, 2);
+ // this.trigger('resize');
- this.width = document.body.clientWidth;
- this.height = document.body.clientHeight;
- this.pixelRatio = Math.min(window.devicePixelRatio, 2);
- this.trigger('resize');
-
- if(this.width < 968 && this.device !== 'mobile') {
- this.device = 'mobile';
- this.trigger('devicechange');
- } else if(this.width >= 968 && this.device !== 'pc') {
- this.device = 'pc';
- this.trigger('devicechange');
- }
- });
+ // if (this.width < 968 && this.device !== 'mobile') {
+ // this.device = 'mobile';
+ // this.trigger('devicechange');
+ // } else if (this.width >= 968 && this.device !== 'pc') {
+ // this.device = 'pc';
+ // this.trigger('devicechange');
+ // }
+ // });
}
}
\ No newline at end of file
--
Gitblit v1.8.0