瀏覽代碼

ViewHelper: Fixed `container` is not defined. (#23605)

linbingquan 3 年之前
父節點
當前提交
364cf4eef5
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      examples/jsm/helpers/ViewHelper.js

+ 2 - 2
examples/jsm/helpers/ViewHelper.js

@@ -148,8 +148,8 @@ class ViewHelper extends THREE.Object3D {
 			if ( this.animating === true ) return false;
 
 			const rect = dom.getBoundingClientRect();
-			const offsetX = rect.left + ( container.dom.offsetWidth - dim );
-			const offsetY = rect.top + ( container.dom.offsetHeight - dim );
+			const offsetX = rect.left + ( dom.offsetWidth - dim );
+			const offsetY = rect.top + ( dom.offsetHeight - dim );
 			mouse.x = ( ( event.clientX - offsetX ) / ( rect.width - offsetX ) ) * 2 - 1;
 			mouse.y = - ( ( event.clientY - offsetY ) / ( rect.bottom - offsetY ) ) * 2 + 1;