MCPcopy
hub / github.com/mrdoob/three.js / pointerMove

Method pointerMove

examples/jsm/controls/TransformControls.js:512–771  ·  view source on GitHub ↗
( pointer )

Source from the content-addressed store, hash-verified

510 }
511
512 pointerMove( pointer ) {
513
514 const axis = this.axis;
515 const mode = this.mode;
516 const object = this.object;
517 let space = this.space;
518
519 if ( mode === 'scale' ) {
520
521 space = 'local';
522
523 } else if ( axis === 'E' || axis === 'XYZE' || axis === 'XYZ' ) {
524
525 space = 'world';
526
527 }
528
529 if ( object === undefined || axis === null || this.dragging === false || ( pointer !== null && pointer.button !== - 1 ) ) return;
530
531 if ( pointer !== null ) _raycaster.setFromCamera( pointer, this.camera );
532
533 const planeIntersect = intersectObjectWithRay( this._plane, _raycaster, true );
534
535 if ( ! planeIntersect ) return;
536
537 this.pointEnd.copy( planeIntersect.point ).sub( this.worldPositionStart );
538
539 if ( mode === 'translate' ) {
540
541 // Apply translate
542
543 this._offset.copy( this.pointEnd ).sub( this.pointStart );
544
545 if ( space === 'local' && axis !== 'XYZ' ) {
546
547 this._offset.applyQuaternion( this._worldQuaternionInv );
548
549 }
550
551 if ( axis.indexOf( 'X' ) === - 1 ) this._offset.x = 0;
552 if ( axis.indexOf( 'Y' ) === - 1 ) this._offset.y = 0;
553 if ( axis.indexOf( 'Z' ) === - 1 ) this._offset.z = 0;
554
555 if ( space === 'local' && axis !== 'XYZ' ) {
556
557 this._offset.applyQuaternion( this._quaternionStart ).divide( this._parentScale );
558
559 } else {
560
561 this._offset.applyQuaternion( this._parentQuaternionInv ).divide( this._parentScale );
562
563 }
564
565 object.position.copy( this._offset ).add( this._positionStart );
566
567 // Apply translation snap
568
569 if ( this.translationSnap ) {

Callers 2

onControllerEventMethod · 0.80
onPointerMoveFunction · 0.80

Calls 15

intersectObjectWithRayFunction · 0.85
setFromCameraMethod · 0.80
getWorldPositionMethod · 0.80
worldToLocalMethod · 0.80
setFromAxisAngleMethod · 0.80
subMethod · 0.45
copyMethod · 0.45
applyQuaternionMethod · 0.45
divideMethod · 0.45
addMethod · 0.45
invertMethod · 0.45
roundMethod · 0.45

Tested by

no test coverage detected