three-base 1.0.71 → 1.0.73

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/ThreeBase.js CHANGED
@@ -78,10 +78,7 @@ export default class ThreeBase extends EventDispatcher {
78
78
  div.append(this.renderer.domElement);
79
79
  // 监听容器的尺寸的改变
80
80
  elementResizeEvent(div, () => {
81
- let rect = window.getComputedStyle(div);
82
- let width = parseInt(rect.width);
83
- let height = parseInt(rect.height);
84
- this.resize(width, height);
81
+ this.resize(div.clientWidth, div.clientHeight);
85
82
  });
86
83
  // 如果上下文被销毁了, 就恢复上下文
87
84
  if (this.isRendererContextLost) {
@@ -90,10 +87,7 @@ export default class ThreeBase extends EventDispatcher {
90
87
  await new Promise(resolve => requestAnimationFrame(resolve));
91
88
  this.renderer.domElement.style.opacity = "1";
92
89
  }
93
- let rect = window.getComputedStyle(div);
94
- let width = parseInt(rect.width);
95
- let height = parseInt(rect.height);
96
- this.resize(width, height);
90
+ this.resize(div.clientWidth, div.clientHeight);
97
91
  // 开启时时渲染
98
92
  threeUtils.removeEventListener("requestAnimationFrame", this.renderBindThis);
99
93
  threeUtils.addEventListener("requestAnimationFrame", this.renderBindThis);
package/lib/ThreeBase.ts CHANGED
@@ -94,10 +94,7 @@ export default class ThreeBase extends EventDispatcher {
94
94
 
95
95
  // 监听容器的尺寸的改变
96
96
  elementResizeEvent(div, () => {
97
- let rect = window.getComputedStyle(div);
98
- let width = parseInt(rect.width);
99
- let height = parseInt(rect.height);
100
- this.resize(width, height);
97
+ this.resize(div.clientWidth, div.clientHeight);
101
98
  });
102
99
 
103
100
  // 如果上下文被销毁了, 就恢复上下文
@@ -108,10 +105,7 @@ export default class ThreeBase extends EventDispatcher {
108
105
  this.renderer.domElement.style.opacity = "1";
109
106
  }
110
107
 
111
- let rect = window.getComputedStyle(div);
112
- let width = parseInt(rect.width);
113
- let height = parseInt(rect.height);
114
- this.resize(width, height);
108
+ this.resize(div.clientWidth, div.clientHeight);
115
109
 
116
110
  // 开启时时渲染
117
111
  threeUtils.removeEventListener("requestAnimationFrame", this.renderBindThis);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "three-base",
3
- "version": "1.0.71",
3
+ "version": "1.0.73",
4
4
  "description": "three 3d three-base",
5
5
  "repository": {
6
6
  "type": "git",