瀏覽代碼

Examples: Improve SelectionHelper.js (#24322)

linbingquan 3 年之前
父節點
當前提交
66eaa789e4
共有 1 個文件被更改,包括 5 次插入3 次删除
  1. 5 3
      examples/jsm/interactive/SelectionHelper.js

+ 5 - 3
examples/jsm/interactive/SelectionHelper.js

@@ -1,6 +1,4 @@
-import {
-	Vector2
-} from 'three';
+import { Vector2 } from 'three';
 
 class SelectionHelper {
 
@@ -58,6 +56,8 @@ class SelectionHelper {
 
 	onSelectStart( event ) {
 
+		this.element.style.display = 'none';
+
 		this.renderer.domElement.parentElement.appendChild( this.element );
 
 		this.element.style.left = event.clientX + 'px';
@@ -72,6 +72,8 @@ class SelectionHelper {
 
 	onSelectMove( event ) {
 
+		this.element.style.display = 'block';
+
 		this.pointBottomRight.x = Math.max( this.startPoint.x, event.clientX );
 		this.pointBottomRight.y = Math.max( this.startPoint.y, event.clientY );
 		this.pointTopLeft.x = Math.min( this.startPoint.x, event.clientX );