@soonspacejs/plugin-drag-controls 2.13.6 → 2.13.7
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/README.md +5 -5
- package/dist/index.esm.js +343 -1
- package/dist/index.esm.js.map +1 -0
- package/package.json +3 -3
- package/dist/index.d.ts +0 -16
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
# @soonspacejs/plugin-drag-controls
|
|
2
|
-
|
|
3
|
-
> Drag Controls Plugin plugin for SoonSpace.js
|
|
4
|
-
|
|
5
|
-
Document: [http://www.xwbuilders.com:8800/plugin/drag-controls.html](http://www.xwbuilders.com:8800/plugin/drag-controls.html)
|
|
1
|
+
# @soonspacejs/plugin-drag-controls
|
|
2
|
+
|
|
3
|
+
> Drag Controls Plugin plugin for SoonSpace.js
|
|
4
|
+
|
|
5
|
+
Document: [http://www.xwbuilders.com:8800/plugin/drag-controls.html](http://www.xwbuilders.com:8800/plugin/drag-controls.html)
|
package/dist/index.esm.js
CHANGED
|
@@ -1 +1,343 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Plane, Vector2, Vector3, Matrix4, Controls, Raycaster, MOUSE, TOUCH } from 'three';
|
|
2
|
+
|
|
3
|
+
const _plane = new Plane();
|
|
4
|
+
|
|
5
|
+
const _pointer = new Vector2();
|
|
6
|
+
const _offset = new Vector3();
|
|
7
|
+
const _diff = new Vector2();
|
|
8
|
+
const _previousPointer = new Vector2();
|
|
9
|
+
const _intersection = new Vector3();
|
|
10
|
+
const _worldPosition = new Vector3();
|
|
11
|
+
const _inverseMatrix = new Matrix4();
|
|
12
|
+
|
|
13
|
+
const _up = new Vector3();
|
|
14
|
+
const _right = new Vector3();
|
|
15
|
+
|
|
16
|
+
let _selected = null;
|
|
17
|
+
const _intersections = [];
|
|
18
|
+
|
|
19
|
+
const STATE = {
|
|
20
|
+
NONE: -1,
|
|
21
|
+
PAN: 0,
|
|
22
|
+
ROTATE: 1,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
class DragControls extends Controls {
|
|
26
|
+
|
|
27
|
+
constructor ( objects, camera, domElement = null ) {
|
|
28
|
+
|
|
29
|
+
super( camera, domElement );
|
|
30
|
+
|
|
31
|
+
this.objects = objects;
|
|
32
|
+
this.objectSet = new WeakSet( objects );
|
|
33
|
+
this.poiNodeSet = new Set();
|
|
34
|
+
objects.forEach( obj => {
|
|
35
|
+
|
|
36
|
+
if ( obj.stype === 'PoiNode' ) {
|
|
37
|
+
|
|
38
|
+
this.poiNodeSet.add( obj );
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
} );
|
|
43
|
+
|
|
44
|
+
this.recursive = true;
|
|
45
|
+
this.transformGroup = false;
|
|
46
|
+
this.rotateSpeed = 1;
|
|
47
|
+
|
|
48
|
+
this.raycaster = new Raycaster();
|
|
49
|
+
|
|
50
|
+
// interaction
|
|
51
|
+
|
|
52
|
+
this.mouseButtons = { LEFT: MOUSE.PAN, MIDDLE: MOUSE.PAN, RIGHT: MOUSE.ROTATE, };
|
|
53
|
+
this.touches = { ONE: TOUCH.PAN, };
|
|
54
|
+
|
|
55
|
+
// event listeners
|
|
56
|
+
|
|
57
|
+
this._onPointerMove = onPointerMove.bind( this );
|
|
58
|
+
this._onPointerDown = onPointerDown.bind( this );
|
|
59
|
+
this._onPointerCancel = onPointerCancel.bind( this );
|
|
60
|
+
|
|
61
|
+
//
|
|
62
|
+
|
|
63
|
+
if ( domElement !== null ) {
|
|
64
|
+
|
|
65
|
+
this.connect();
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
connect () {
|
|
72
|
+
|
|
73
|
+
this.domElement.addEventListener( 'pointermove', this._onPointerMove );
|
|
74
|
+
this.domElement.addEventListener( 'pointerdown', this._onPointerDown );
|
|
75
|
+
this.domElement.addEventListener( 'pointerup', this._onPointerCancel );
|
|
76
|
+
this.domElement.addEventListener( 'pointerleave', this._onPointerCancel );
|
|
77
|
+
this.domElement.addEventListener( 'contextmenu', this._onContextMenu );
|
|
78
|
+
|
|
79
|
+
this.domElement.style.touchAction = 'none'; // disable touch scroll
|
|
80
|
+
this.domElement.style.userSelect = 'none'; // disable selction
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
disconnect () {
|
|
85
|
+
|
|
86
|
+
this.domElement.removeEventListener( 'pointermove', this._onPointerMove );
|
|
87
|
+
this.domElement.removeEventListener( 'pointerdown', this._onPointerDown );
|
|
88
|
+
this.domElement.removeEventListener( 'pointerup', this._onPointerCancel );
|
|
89
|
+
this.domElement.removeEventListener( 'pointerleave', this._onPointerCancel );
|
|
90
|
+
this.domElement.removeEventListener( 'contextmenu', this._onContextMenu );
|
|
91
|
+
|
|
92
|
+
this.domElement.style.touchAction = 'auto';
|
|
93
|
+
this.domElement.style.userSelect = 'auto';
|
|
94
|
+
this.domElement.style.cursor = '';
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
dispose () {
|
|
99
|
+
|
|
100
|
+
this.disconnect();
|
|
101
|
+
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
_updatePointer ( event ) {
|
|
105
|
+
|
|
106
|
+
const rect = this.domElement.getBoundingClientRect();
|
|
107
|
+
|
|
108
|
+
_pointer.x = ( ( event.clientX - rect.left ) / rect.width ) * 2 - 1;
|
|
109
|
+
_pointer.y = ( -( event.clientY - rect.top ) / rect.height ) * 2 + 1;
|
|
110
|
+
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
_updateState ( event ) {
|
|
114
|
+
|
|
115
|
+
// determine action
|
|
116
|
+
|
|
117
|
+
let action;
|
|
118
|
+
|
|
119
|
+
if ( event.pointerType === 'touch' ) {
|
|
120
|
+
|
|
121
|
+
action = this.touches.ONE;
|
|
122
|
+
|
|
123
|
+
} else {
|
|
124
|
+
|
|
125
|
+
switch ( event.button ) {
|
|
126
|
+
|
|
127
|
+
case 0:
|
|
128
|
+
action = this.mouseButtons.LEFT;
|
|
129
|
+
break
|
|
130
|
+
|
|
131
|
+
case 1:
|
|
132
|
+
action = this.mouseButtons.MIDDLE;
|
|
133
|
+
break
|
|
134
|
+
|
|
135
|
+
case 2:
|
|
136
|
+
action = this.mouseButtons.RIGHT;
|
|
137
|
+
break
|
|
138
|
+
|
|
139
|
+
default:
|
|
140
|
+
action = null;
|
|
141
|
+
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// determine state
|
|
147
|
+
|
|
148
|
+
switch ( action ) {
|
|
149
|
+
|
|
150
|
+
case MOUSE.PAN:
|
|
151
|
+
case TOUCH.PAN:
|
|
152
|
+
this.state = STATE.PAN;
|
|
153
|
+
|
|
154
|
+
break
|
|
155
|
+
|
|
156
|
+
case MOUSE.ROTATE:
|
|
157
|
+
case TOUCH.ROTATE:
|
|
158
|
+
this.state = STATE.ROTATE;
|
|
159
|
+
|
|
160
|
+
break
|
|
161
|
+
|
|
162
|
+
default:
|
|
163
|
+
this.state = STATE.NONE;
|
|
164
|
+
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function onPointerMove ( event ) {
|
|
172
|
+
|
|
173
|
+
const camera = this.object;
|
|
174
|
+
this.domElement;
|
|
175
|
+
const raycaster = this.raycaster;
|
|
176
|
+
|
|
177
|
+
if ( this.enabled === false ) return
|
|
178
|
+
|
|
179
|
+
this._updatePointer( event );
|
|
180
|
+
|
|
181
|
+
raycaster.setFromCamera( _pointer, camera );
|
|
182
|
+
|
|
183
|
+
if ( _selected ) {
|
|
184
|
+
|
|
185
|
+
if ( this.state === STATE.PAN ) {
|
|
186
|
+
|
|
187
|
+
if ( raycaster.ray.intersectPlane( _plane, _intersection ) ) {
|
|
188
|
+
|
|
189
|
+
_selected.position.copy( _intersection.sub( _offset ).applyMatrix4( _inverseMatrix ) );
|
|
190
|
+
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
} else if ( this.state === STATE.ROTATE ) {
|
|
194
|
+
|
|
195
|
+
_diff.subVectors( _pointer, _previousPointer ).multiplyScalar( this.rotateSpeed );
|
|
196
|
+
_selected.rotateOnWorldAxis( _up, _diff.x );
|
|
197
|
+
_selected.rotateOnWorldAxis( _right.normalize(), -_diff.y );
|
|
198
|
+
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
this.dispatchEvent( { type: 'drag', object: _selected, } );
|
|
202
|
+
|
|
203
|
+
_previousPointer.copy( _pointer );
|
|
204
|
+
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
_previousPointer.copy( _pointer );
|
|
208
|
+
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function onPointerDown ( event ) {
|
|
212
|
+
|
|
213
|
+
const camera = this.object;
|
|
214
|
+
const domElement = this.domElement;
|
|
215
|
+
const raycaster = this.raycaster;
|
|
216
|
+
|
|
217
|
+
if ( this.enabled === false ) return
|
|
218
|
+
|
|
219
|
+
this._updatePointer( event );
|
|
220
|
+
this._updateState( event );
|
|
221
|
+
|
|
222
|
+
_intersections.length = 0;
|
|
223
|
+
|
|
224
|
+
let intersectionObject = null;
|
|
225
|
+
|
|
226
|
+
this.poiNodeSet.forEach( ( poiNode ) => {
|
|
227
|
+
|
|
228
|
+
if ( poiNode.element.contains( event.target ) ) {
|
|
229
|
+
|
|
230
|
+
intersectionObject = poiNode;
|
|
231
|
+
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
} );
|
|
235
|
+
if ( !intersectionObject ) {
|
|
236
|
+
|
|
237
|
+
raycaster.setFromCamera( _pointer, camera );
|
|
238
|
+
raycaster.intersectObjects( this.objects, this.recursive, _intersections );
|
|
239
|
+
intersectionObject = _intersections[ 0 ] ? _intersections[ 0 ].object : null;
|
|
240
|
+
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if ( intersectionObject ) {
|
|
244
|
+
|
|
245
|
+
// look for the outermost group in the object's upper hierarchy
|
|
246
|
+
|
|
247
|
+
_selected = findObject( intersectionObject, this.objectSet ) ?? intersectionObject;
|
|
248
|
+
|
|
249
|
+
_plane.setFromNormalAndCoplanarPoint(
|
|
250
|
+
camera.getWorldDirection( _plane.normal ),
|
|
251
|
+
_worldPosition.setFromMatrixPosition( _selected.matrixWorld )
|
|
252
|
+
);
|
|
253
|
+
|
|
254
|
+
if ( raycaster.ray.intersectPlane( _plane, _intersection ) ) {
|
|
255
|
+
|
|
256
|
+
if ( this.state === STATE.PAN ) {
|
|
257
|
+
|
|
258
|
+
_inverseMatrix.copy( _selected.parent.matrixWorld ).invert();
|
|
259
|
+
_offset.copy( _intersection ).sub( _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) );
|
|
260
|
+
|
|
261
|
+
} else if ( this.state === STATE.ROTATE ) {
|
|
262
|
+
|
|
263
|
+
// the controls only support Y+ up
|
|
264
|
+
_up.set( 0, 1, 0 ).applyQuaternion( camera.quaternion ).normalize();
|
|
265
|
+
_right.set( 1, 0, 0 ).applyQuaternion( camera.quaternion ).normalize();
|
|
266
|
+
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
domElement.style.cursor = 'move';
|
|
272
|
+
|
|
273
|
+
this.dispatchEvent( { type: 'dragstart', object: _selected, } );
|
|
274
|
+
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
_previousPointer.copy( _pointer );
|
|
278
|
+
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
function onPointerCancel () {
|
|
282
|
+
|
|
283
|
+
if ( this.enabled === false ) return
|
|
284
|
+
|
|
285
|
+
if ( _selected ) {
|
|
286
|
+
|
|
287
|
+
this.dispatchEvent( { type: 'dragend', object: _selected, } );
|
|
288
|
+
|
|
289
|
+
_selected = null;
|
|
290
|
+
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
this.domElement.style.cursor = 'auto';
|
|
294
|
+
|
|
295
|
+
this.state = STATE.NONE;
|
|
296
|
+
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function findObject ( obj, objectSet ) {
|
|
300
|
+
|
|
301
|
+
// ssp
|
|
302
|
+
if ( objectSet.has( obj ) ) return obj
|
|
303
|
+
|
|
304
|
+
if ( obj.parent === null ) return null
|
|
305
|
+
|
|
306
|
+
return findObject( obj.parent, objectSet )
|
|
307
|
+
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
class DragControlsPlugin {
|
|
311
|
+
constructor(ssp) {
|
|
312
|
+
this.controls = null;
|
|
313
|
+
this.viewport = ssp.viewport;
|
|
314
|
+
}
|
|
315
|
+
start(objects, options = {}) {
|
|
316
|
+
var _a, _b, _c;
|
|
317
|
+
if (!this.controls) {
|
|
318
|
+
const { dragStart, drag, dragEnd, } = options;
|
|
319
|
+
this.controls = new DragControls(objects, this.viewport.camera, this.viewport.container);
|
|
320
|
+
(_a = this.controls) === null || _a === void 0 ? void 0 : _a.addEventListener('dragstart', (e) => {
|
|
321
|
+
this.viewport.controls.enabled = false;
|
|
322
|
+
dragStart === null || dragStart === void 0 ? void 0 : dragStart(e.object);
|
|
323
|
+
});
|
|
324
|
+
(_b = this.controls) === null || _b === void 0 ? void 0 : _b.addEventListener('drag', (e) => {
|
|
325
|
+
this.viewport.render();
|
|
326
|
+
drag === null || drag === void 0 ? void 0 : drag(e.object);
|
|
327
|
+
});
|
|
328
|
+
(_c = this.controls) === null || _c === void 0 ? void 0 : _c.addEventListener('dragend', (e) => {
|
|
329
|
+
this.viewport.controls.enabled = true;
|
|
330
|
+
dragEnd === null || dragEnd === void 0 ? void 0 : dragEnd(e.object);
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
stop() {
|
|
335
|
+
if (this.controls) {
|
|
336
|
+
this.controls.dispose();
|
|
337
|
+
this.controls = null;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
export { DragControlsPlugin as default };
|
|
343
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/DragControls.js","../src/index.ts"],"sourcesContent":["import { Controls, Matrix4, Plane, Raycaster, Vector2, Vector3, MOUSE, TOUCH, } from 'three'\r\n\r\nconst _plane = new Plane()\r\n\r\nconst _pointer = new Vector2()\r\nconst _offset = new Vector3()\r\nconst _diff = new Vector2()\r\nconst _previousPointer = new Vector2()\r\nconst _intersection = new Vector3()\r\nconst _worldPosition = new Vector3()\r\nconst _inverseMatrix = new Matrix4()\r\n\r\nconst _up = new Vector3()\r\nconst _right = new Vector3()\r\n\r\nlet _selected = null\r\nconst _intersections = []\r\n\r\nconst STATE = {\r\n NONE: -1,\r\n PAN: 0,\r\n ROTATE: 1,\r\n}\r\n\r\nclass DragControls extends Controls {\r\n\r\n constructor ( objects, camera, domElement = null ) {\r\n\r\n super( camera, domElement )\r\n\r\n this.objects = objects\r\n this.objectSet = new WeakSet( objects )\r\n this.poiNodeSet = new Set()\r\n objects.forEach( obj => {\r\n \r\n if ( obj.stype === 'PoiNode' ) {\r\n\r\n this.poiNodeSet.add( obj )\r\n \r\n }\r\n \r\n } )\r\n\r\n this.recursive = true\r\n this.transformGroup = false\r\n this.rotateSpeed = 1\r\n\r\n this.raycaster = new Raycaster()\r\n\r\n // interaction\r\n\r\n this.mouseButtons = { LEFT: MOUSE.PAN, MIDDLE: MOUSE.PAN, RIGHT: MOUSE.ROTATE, }\r\n this.touches = { ONE: TOUCH.PAN, }\r\n\r\n // event listeners\r\n\r\n this._onPointerMove = onPointerMove.bind( this )\r\n this._onPointerDown = onPointerDown.bind( this )\r\n this._onPointerCancel = onPointerCancel.bind( this )\r\n\r\n //\r\n\r\n if ( domElement !== null ) {\r\n\r\n this.connect()\r\n \r\n }\r\n \r\n }\r\n\r\n connect () {\r\n\r\n this.domElement.addEventListener( 'pointermove', this._onPointerMove )\r\n this.domElement.addEventListener( 'pointerdown', this._onPointerDown )\r\n this.domElement.addEventListener( 'pointerup', this._onPointerCancel )\r\n this.domElement.addEventListener( 'pointerleave', this._onPointerCancel )\r\n this.domElement.addEventListener( 'contextmenu', this._onContextMenu )\r\n\r\n this.domElement.style.touchAction = 'none' // disable touch scroll\r\n this.domElement.style.userSelect = 'none' // disable selction\r\n \r\n }\r\n\r\n disconnect () {\r\n\r\n this.domElement.removeEventListener( 'pointermove', this._onPointerMove )\r\n this.domElement.removeEventListener( 'pointerdown', this._onPointerDown )\r\n this.domElement.removeEventListener( 'pointerup', this._onPointerCancel )\r\n this.domElement.removeEventListener( 'pointerleave', this._onPointerCancel )\r\n this.domElement.removeEventListener( 'contextmenu', this._onContextMenu )\r\n\r\n this.domElement.style.touchAction = 'auto'\r\n this.domElement.style.userSelect = 'auto'\r\n this.domElement.style.cursor = ''\r\n \r\n }\r\n\r\n dispose () {\r\n\r\n this.disconnect()\r\n \r\n }\r\n\r\n _updatePointer ( event ) {\r\n\r\n const rect = this.domElement.getBoundingClientRect()\r\n\r\n _pointer.x = ( ( event.clientX - rect.left ) / rect.width ) * 2 - 1\r\n _pointer.y = ( -( event.clientY - rect.top ) / rect.height ) * 2 + 1\r\n \r\n }\r\n\r\n _updateState ( event ) {\r\n\r\n // determine action\r\n\r\n let action\r\n\r\n if ( event.pointerType === 'touch' ) {\r\n\r\n action = this.touches.ONE\r\n \r\n } else {\r\n\r\n switch ( event.button ) {\r\n\r\n case 0:\r\n action = this.mouseButtons.LEFT\r\n break\r\n\r\n case 1:\r\n action = this.mouseButtons.MIDDLE\r\n break\r\n\r\n case 2:\r\n action = this.mouseButtons.RIGHT\r\n break\r\n\r\n default:\r\n action = null\r\n \r\n }\r\n \r\n }\r\n\r\n // determine state\r\n\r\n switch ( action ) {\r\n\r\n case MOUSE.PAN:\r\n case TOUCH.PAN:\r\n this.state = STATE.PAN\r\n\r\n break\r\n\r\n case MOUSE.ROTATE:\r\n case TOUCH.ROTATE:\r\n this.state = STATE.ROTATE\r\n\r\n break\r\n\r\n default:\r\n this.state = STATE.NONE\r\n \r\n }\r\n \r\n }\r\n\r\n}\r\n\r\nfunction onPointerMove ( event ) {\r\n\r\n const camera = this.object\r\n const domElement = this.domElement\r\n const raycaster = this.raycaster\r\n\r\n if ( this.enabled === false ) return\r\n\r\n this._updatePointer( event )\r\n\r\n raycaster.setFromCamera( _pointer, camera )\r\n\r\n if ( _selected ) {\r\n\r\n if ( this.state === STATE.PAN ) {\r\n\r\n if ( raycaster.ray.intersectPlane( _plane, _intersection ) ) {\r\n\r\n _selected.position.copy( _intersection.sub( _offset ).applyMatrix4( _inverseMatrix ) )\r\n \r\n }\r\n \r\n } else if ( this.state === STATE.ROTATE ) {\r\n\r\n _diff.subVectors( _pointer, _previousPointer ).multiplyScalar( this.rotateSpeed )\r\n _selected.rotateOnWorldAxis( _up, _diff.x )\r\n _selected.rotateOnWorldAxis( _right.normalize(), -_diff.y )\r\n \r\n }\r\n\r\n this.dispatchEvent( { type: 'drag', object: _selected, } )\r\n\r\n _previousPointer.copy( _pointer )\r\n \r\n } \r\n\r\n _previousPointer.copy( _pointer )\r\n\r\n}\r\n\r\nfunction onPointerDown ( event ) {\r\n\r\n const camera = this.object\r\n const domElement = this.domElement\r\n const raycaster = this.raycaster\r\n\r\n if ( this.enabled === false ) return\r\n\r\n this._updatePointer( event )\r\n this._updateState( event )\r\n\r\n _intersections.length = 0\r\n\r\n let intersectionObject = null\r\n\r\n this.poiNodeSet.forEach( ( poiNode ) => {\r\n \r\n if ( poiNode.element.contains( event.target ) ) {\r\n\r\n intersectionObject = poiNode\r\n \r\n }\r\n \r\n } )\r\n if ( !intersectionObject ) {\r\n\r\n raycaster.setFromCamera( _pointer, camera )\r\n raycaster.intersectObjects( this.objects, this.recursive, _intersections )\r\n intersectionObject = _intersections[ 0 ] ? _intersections[ 0 ].object : null\r\n \r\n }\r\n\r\n if ( intersectionObject ) {\r\n\r\n // look for the outermost group in the object's upper hierarchy\r\n\r\n _selected = findObject( intersectionObject, this.objectSet ) ?? intersectionObject\r\n \r\n _plane.setFromNormalAndCoplanarPoint(\r\n camera.getWorldDirection( _plane.normal ),\r\n _worldPosition.setFromMatrixPosition( _selected.matrixWorld )\r\n )\r\n\r\n if ( raycaster.ray.intersectPlane( _plane, _intersection ) ) {\r\n\r\n if ( this.state === STATE.PAN ) {\r\n\r\n _inverseMatrix.copy( _selected.parent.matrixWorld ).invert()\r\n _offset.copy( _intersection ).sub( _worldPosition.setFromMatrixPosition( _selected.matrixWorld ) )\r\n \r\n } else if ( this.state === STATE.ROTATE ) {\r\n\r\n // the controls only support Y+ up\r\n _up.set( 0, 1, 0 ).applyQuaternion( camera.quaternion ).normalize()\r\n _right.set( 1, 0, 0 ).applyQuaternion( camera.quaternion ).normalize()\r\n \r\n }\r\n \r\n }\r\n\r\n domElement.style.cursor = 'move'\r\n\r\n this.dispatchEvent( { type: 'dragstart', object: _selected, } )\r\n \r\n }\r\n\r\n _previousPointer.copy( _pointer )\r\n\r\n}\r\n\r\nfunction onPointerCancel () {\r\n\r\n if ( this.enabled === false ) return\r\n\r\n if ( _selected ) {\r\n\r\n this.dispatchEvent( { type: 'dragend', object: _selected, } )\r\n\r\n _selected = null\r\n \r\n }\r\n\r\n this.domElement.style.cursor = 'auto'\r\n\r\n this.state = STATE.NONE\r\n\r\n}\r\n\r\nfunction findObject ( obj, objectSet ) {\r\n\r\n // ssp\r\n if ( objectSet.has( obj ) ) return obj\r\n\r\n if ( obj.parent === null ) return null\r\n\r\n return findObject( obj.parent, objectSet )\r\n\r\n}\r\n\r\nexport { DragControls, }\r\n","import SoonSpace from 'soonspacejs'\r\nimport { DragControls as sDragControls, } from './DragControls'\r\nimport { DragControls, } from 'three/examples/jsm/controls/DragControls.js'\r\nimport { Object3D, } from 'three'\r\n\r\nexport interface StartOptions {\r\n dragStart?: ( object: Object3D ) => void;\r\n drag?: ( object: Object3D ) => void;\r\n dragEnd?: ( object: Object3D ) => void;\r\n}\r\n\r\nclass DragControlsPlugin {\r\n\r\n controls: DragControls | null = null\r\n viewport: SoonSpace['viewport']\r\n\r\n constructor ( ssp: SoonSpace ) {\r\n\r\n this.viewport = ssp.viewport\r\n \r\n }\r\n\r\n start ( objects: Object3D[], options: StartOptions = {} ) {\r\n\r\n if ( !this.controls ) {\r\n\r\n const { dragStart, drag, dragEnd, } = options\r\n\r\n this.controls = new ( sDragControls as any )( objects, this.viewport.camera, this.viewport.container )\r\n this.controls?.addEventListener( 'dragstart', ( e ) => {\r\n\r\n this.viewport.controls.enabled = false\r\n dragStart?.( e.object )\r\n \r\n } )\r\n this.controls?.addEventListener( 'drag', ( e ) => {\r\n\r\n this.viewport.render()\r\n drag?.( e.object )\r\n \r\n } )\r\n this.controls?.addEventListener( 'dragend', ( e ) => {\r\n\r\n this.viewport.controls.enabled = true\r\n dragEnd?.( e.object )\r\n \r\n } )\r\n \r\n }\r\n \r\n }\r\n\r\n stop () {\r\n\r\n if ( this.controls ) {\r\n\r\n this.controls.dispose()\r\n this.controls = null\r\n \r\n }\r\n \r\n }\r\n\r\n}\r\n\r\nexport default DragControlsPlugin"],"names":["sDragControls"],"mappings":";;AAEA,MAAM,MAAM,GAAG,IAAI,KAAK,GAAE;AAC1B;AACA,MAAM,QAAQ,GAAG,IAAI,OAAO,GAAE;AAC9B,MAAM,OAAO,GAAG,IAAI,OAAO,GAAE;AAC7B,MAAM,KAAK,GAAG,IAAI,OAAO,GAAE;AAC3B,MAAM,gBAAgB,GAAG,IAAI,OAAO,GAAE;AACtC,MAAM,aAAa,GAAG,IAAI,OAAO,GAAE;AACnC,MAAM,cAAc,GAAG,IAAI,OAAO,GAAE;AACpC,MAAM,cAAc,GAAG,IAAI,OAAO,GAAE;AACpC;AACA,MAAM,GAAG,GAAG,IAAI,OAAO,GAAE;AACzB,MAAM,MAAM,GAAG,IAAI,OAAO,GAAE;AAC5B;AACA,IAAI,SAAS,GAAG,KAAI;AACpB,MAAM,cAAc,GAAG,GAAE;AACzB;AACA,MAAM,KAA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AAA,CAAA,gBAAgB,CAAE,MAAM,EAAE,CAAE,CAAC,KAAK;AAE/C,gBAAA,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAA;gBACtB,IAAI,KAAA,IAAA,IAAJ,IAAI,KAAJ,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,IAAI,CAAI,CAAC,CAAC,MAAM,CAAE,CAAA;AAEpB,aAAC,CAAE,CAAA;YACH,CAAA,EAAA,GAAA,IAAI,CAAC,QAAQ,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,gBAAgB,CAAE,SAAS,EAAE,CAAE,CAAC,KAAK;gBAElD,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAA;gBACrC,OAAO,KAAA,IAAA,IAAP,OAAO,KAAP,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,OAAO,CAAI,CAAC,CAAC,MAAM,CAAE,CAAA;AAEvB,aAAC,CAAE,CAAA;AAEJ,SAAA;KAEF;IAED,IAAI,GAAA;QAEF,IAAK,IAAI,CAAC,QAAQ,EAAG;AAEnB,YAAA,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAA;AACvB,YAAA,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAA;AAErB,SAAA;KAEF;AAEF;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soonspacejs/plugin-drag-controls",
|
|
3
3
|
"pluginName": "Drag Controls Plugin",
|
|
4
|
-
"version": "2.13.
|
|
4
|
+
"version": "2.13.7",
|
|
5
5
|
"description": "Drag Controls Plugin plugin for SoonSpace.js",
|
|
6
6
|
"main": "dist/index.esm.js",
|
|
7
7
|
"module": "dist/index.esm.js",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
],
|
|
14
14
|
"author": "xunwei",
|
|
15
15
|
"license": "UNLICENSED",
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "550040550bf20ec0015982ff1159d0cfe9b35ed3",
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"soonspacejs": "2.13.
|
|
18
|
+
"soonspacejs": "2.13.7"
|
|
19
19
|
}
|
|
20
20
|
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import SoonSpace from 'soonspacejs';
|
|
2
|
-
import { DragControls } from 'three/examples/jsm/controls/DragControls.js';
|
|
3
|
-
import { Object3D } from 'three';
|
|
4
|
-
export interface StartOptions {
|
|
5
|
-
dragStart?: (object: Object3D) => void;
|
|
6
|
-
drag?: (object: Object3D) => void;
|
|
7
|
-
dragEnd?: (object: Object3D) => void;
|
|
8
|
-
}
|
|
9
|
-
declare class DragControlsPlugin {
|
|
10
|
-
controls: DragControls | null;
|
|
11
|
-
viewport: SoonSpace['viewport'];
|
|
12
|
-
constructor(ssp: SoonSpace);
|
|
13
|
-
start(objects: Object3D[], options?: StartOptions): void;
|
|
14
|
-
stop(): void;
|
|
15
|
-
}
|
|
16
|
-
export default DragControlsPlugin;
|