Browse Source

Docs: Improve `DragControls` page. (#27822)

Michael Herzog 1 năm trước cách đây
mục cha
commit
8a903aa2c5

+ 5 - 0
docs/examples/en/controls/DragControls.html

@@ -150,6 +150,11 @@
 			Returns the internal [page:Raycaster] instance that is used for intersection tests.
 		</p>
 
+		<h3>[method:undefined setObjects] ( [param:Array objects] )</h3>
+		<p>
+			Sets an array of draggable objects by overwriting the existing one.
+		</p>
+
 		<h2>Source</h2>
 
 		<p>

+ 10 - 0
docs/examples/ko/controls/DragControls.html

@@ -109,6 +109,11 @@
 			*true* 값으로 설정 되어있다면, [name]은 개별 객체가 아닌 전체 그룹은 드래그 합니다. 기본 값은 *false* 입니다.
 		</p>
 
+		<h3>[property:String mode]</h3>
+		<p>
+			The current transformation mode. Possible values are `translate`, and `rotate`. Default is `translate`.
+		</p>
+
 		<h2>메소드</h2>
 
 		<p>일반적인 메소드는 [page:EventDispatcher] 클래스를 참조하세요.</p>
@@ -138,6 +143,11 @@
 			Returns the internal [page:Raycaster] instance that is used for intersection tests.
 		</p>
 
+		<h3>[method:undefined setObjects] ( [param:Array objects] )</h3>
+		<p>
+			Sets an array of draggable objects by overwriting the existing one.
+		</p>
+
 		<h2>Source</h2>
 
 		<p>

+ 10 - 0
docs/examples/zh/controls/DragControls.html

@@ -107,6 +107,11 @@
 			当[page:DragControls.objects]数组包含一个单个可拖拽的组对象时该选项生效。如果设置为`true`,[name]会转换整个组对象,而不对单个对象做转换。默认值为`false`。
 		</p>
 
+		<h3>[property:String mode]</h3>
+		<p>
+			The current transformation mode. Possible values are `translate`, and `rotate`. Default is `translate`.
+		</p>
+
 		<h2>方法</h2>
 
 		<p>共有方法请参见其基类[page:EventDispatcher]。</p>
@@ -136,6 +141,11 @@
 			返回用于相交测试的内部[page:Raycaster]实例。
 		</p>
 
+		<h3>[method:undefined setObjects] ( [param:Array objects] )</h3>
+		<p>
+			Sets an array of draggable objects by overwriting the existing one.
+		</p>
+
 		<h2>Source</h2>
 
 		<p>

+ 8 - 7
examples/jsm/controls/DragControls.js

@@ -30,7 +30,7 @@ class DragControls extends EventDispatcher {
 		_domElement.style.touchAction = 'none'; // disable touch scroll
 
 		let _selected = null, _hovered = null;
- 
+
 		const _intersections = [];
 
 		this.mode = 'translate';
@@ -73,8 +73,10 @@ class DragControls extends EventDispatcher {
 
 		}
 
-		function setObjects(object){ //array of object
-			_objects = object
+		function setObjects( objects ) {
+
+			_objects = objects;
+
 		}
 
 		function getRaycaster() {
@@ -185,7 +187,7 @@ class DragControls extends EventDispatcher {
 				if ( scope.transformGroup === true ) {
 
 					// look for the outermost group in the object's upper hierarchy
-          
+
 					_selected = findGroup( _intersections[ 0 ].object );
 
 				} else {
@@ -249,7 +251,7 @@ class DragControls extends EventDispatcher {
 		}
 
 		function findGroup( obj, group = null ) {
-			
+
 			if ( obj.isGroup ) group = obj;
 
 			if ( obj.parent === null ) return group;
@@ -257,7 +259,7 @@ class DragControls extends EventDispatcher {
 			return findGroup( obj.parent, group );
 
 		}
-  
+
 		activate();
 
 		// API
@@ -277,5 +279,4 @@ class DragControls extends EventDispatcher {
 
 }
 
-
 export { DragControls };