three-base 1.0.74 → 1.0.75

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/lib/threeUtils.js CHANGED
@@ -46,10 +46,8 @@ class ThreeUtils extends EventDispatcher {
46
46
  this._keepZoomDoms = this._keepZoomDoms.filter(l => this.inDocument(l.dom));
47
47
  //2.设置dom的缩放值样式
48
48
  this._keepZoomDoms.map((item, i) => {
49
- let parentRact = window.getComputedStyle(item.dom.parentNode);
50
- let width = parseInt(parentRact.width);
51
- let height = parseInt(parentRact.height);
52
- let scale = Math.min(width / item.width, height / item.height);
49
+ let parentDom = item.dom.parentNode;
50
+ let scale = Math.min(parentDom.clientWidth / item.width, parentDom.clientHeight / item.height);
53
51
  Object.assign(item.dom.style, {
54
52
  position: "absolute",
55
53
  top: "50%",
@@ -70,6 +68,7 @@ class ThreeUtils extends EventDispatcher {
70
68
  // 把配置加入到列表中
71
69
  this._keepZoomDoms.push({ dom, width, height });
72
70
  dom.dataset.a = "这个元素缩放比例由 threeUtils.keepZoom 方法设置";
71
+ this._computerDomZoom();
73
72
  }
74
73
  }
75
74
  workList = [];
package/lib/threeUtils.ts CHANGED
@@ -63,10 +63,8 @@ class ThreeUtils extends EventDispatcher {
63
63
 
64
64
  //2.设置dom的缩放值样式
65
65
  this._keepZoomDoms.map((item, i) => {
66
- let parentRact = window.getComputedStyle(item.dom.parentNode as Element);
67
- let width = parseInt(parentRact.width);
68
- let height = parseInt(parentRact.height);
69
- let scale = Math.min(width / item.width, height / item.height);
66
+ let parentDom = item.dom.parentNode as HTMLDivElement;
67
+ let scale = Math.min(parentDom.clientWidth / item.width, parentDom.clientHeight / item.height);
70
68
  Object.assign(item.dom.style, {
71
69
  position: "absolute",
72
70
  top: "50%",
@@ -91,6 +89,8 @@ class ThreeUtils extends EventDispatcher {
91
89
  this._keepZoomDoms.push({ dom, width, height });
92
90
 
93
91
  dom.dataset.a = "这个元素缩放比例由 threeUtils.keepZoom 方法设置";
92
+
93
+ this._computerDomZoom();
94
94
  }
95
95
  }
96
96
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "three-base",
3
- "version": "1.0.74",
3
+ "version": "1.0.75",
4
4
  "description": "three 3d three-base",
5
5
  "repository": {
6
6
  "type": "git",