copper3d 1.15.3 → 1.15.5

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.
@@ -45209,9 +45209,9 @@ class OBJLoader extends Loader {
45209
45209
 
45210
45210
  const objLoader = new OBJLoader();
45211
45211
 
45212
- const _changeEvent$2 = { type: "change" };
45213
- const _startEvent$2 = { type: "start" };
45214
- const _endEvent$2 = { type: "end" };
45212
+ const _changeEvent$3 = { type: "change" };
45213
+ const _startEvent$3 = { type: "start" };
45214
+ const _endEvent$3 = { type: "end" };
45215
45215
  class Copper3dTrackballControls extends EventDispatcher {
45216
45216
  constructor(object, domElement) {
45217
45217
  super();
@@ -45432,7 +45432,7 @@ class Copper3dTrackballControls extends EventDispatcher {
45432
45432
  scope.checkDistances();
45433
45433
  scope.object.lookAt(scope.target);
45434
45434
  if (lastPosition.distanceToSquared(scope.object.position) > EPS) {
45435
- scope.dispatchEvent(_changeEvent$2);
45435
+ scope.dispatchEvent(_changeEvent$3);
45436
45436
  lastPosition.copy(scope.object.position);
45437
45437
  }
45438
45438
  }
@@ -45440,7 +45440,7 @@ class Copper3dTrackballControls extends EventDispatcher {
45440
45440
  scope.object.lookAt(scope.target);
45441
45441
  if (lastPosition.distanceToSquared(scope.object.position) > EPS ||
45442
45442
  lastZoom !== scope.object.zoom) {
45443
- scope.dispatchEvent(_changeEvent$2);
45443
+ scope.dispatchEvent(_changeEvent$3);
45444
45444
  lastPosition.copy(scope.object.position);
45445
45445
  lastZoom = scope.object.zoom;
45446
45446
  }
@@ -45459,7 +45459,7 @@ class Copper3dTrackballControls extends EventDispatcher {
45459
45459
  scope.object.updateProjectionMatrix();
45460
45460
  _eye.subVectors(scope.object.position, scope.target);
45461
45461
  scope.object.lookAt(scope.target);
45462
- scope.dispatchEvent(_changeEvent$2);
45462
+ scope.dispatchEvent(_changeEvent$3);
45463
45463
  lastPosition.copy(scope.object.position);
45464
45464
  lastZoom = scope.object.zoom;
45465
45465
  };
@@ -45559,7 +45559,7 @@ class Copper3dTrackballControls extends EventDispatcher {
45559
45559
  _panStart.copy(getMouseOnScreen(event.pageX, event.pageY));
45560
45560
  _panEnd.copy(_panStart);
45561
45561
  }
45562
- scope.dispatchEvent(_startEvent$2);
45562
+ scope.dispatchEvent(_startEvent$3);
45563
45563
  }
45564
45564
  function onMouseMove(event) {
45565
45565
  const state = _keyState !== STATE.NONE ? _keyState : _state;
@@ -45576,7 +45576,7 @@ class Copper3dTrackballControls extends EventDispatcher {
45576
45576
  }
45577
45577
  function onMouseUp(event) {
45578
45578
  _state = STATE.NONE;
45579
- scope.dispatchEvent(_endEvent$2);
45579
+ scope.dispatchEvent(_endEvent$3);
45580
45580
  }
45581
45581
  function onMouseWheel(event) {
45582
45582
  if (scope.enabled === false)
@@ -45598,8 +45598,8 @@ class Copper3dTrackballControls extends EventDispatcher {
45598
45598
  _zoomStart.y -= event.deltaY * 0.00025;
45599
45599
  break;
45600
45600
  }
45601
- scope.dispatchEvent(_startEvent$2);
45602
- scope.dispatchEvent(_endEvent$2);
45601
+ scope.dispatchEvent(_startEvent$3);
45602
+ scope.dispatchEvent(_endEvent$3);
45603
45603
  }
45604
45604
  function onTouchStart(event) {
45605
45605
  trackPointer(event);
@@ -45620,7 +45620,7 @@ class Copper3dTrackballControls extends EventDispatcher {
45620
45620
  _panEnd.copy(_panStart);
45621
45621
  break;
45622
45622
  }
45623
- scope.dispatchEvent(_startEvent$2);
45623
+ scope.dispatchEvent(_startEvent$3);
45624
45624
  }
45625
45625
  function onTouchMove(event) {
45626
45626
  trackPointer(event);
@@ -45662,7 +45662,7 @@ class Copper3dTrackballControls extends EventDispatcher {
45662
45662
  }
45663
45663
  break;
45664
45664
  }
45665
- scope.dispatchEvent(_endEvent$2);
45665
+ scope.dispatchEvent(_endEvent$3);
45666
45666
  }
45667
45667
  // function onTouchStart(event: PointerEvent) {
45668
45668
  // trackPointer(event);
@@ -45823,9 +45823,9 @@ class Copper3dTrackballControls extends EventDispatcher {
45823
45823
  // Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish
45824
45824
  // Pan - right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move
45825
45825
 
45826
- const _changeEvent$1 = { type: 'change' };
45827
- const _startEvent$1 = { type: 'start' };
45828
- const _endEvent$1 = { type: 'end' };
45826
+ const _changeEvent$2 = { type: 'change' };
45827
+ const _startEvent$2 = { type: 'start' };
45828
+ const _endEvent$2 = { type: 'end' };
45829
45829
 
45830
45830
  class OrbitControls extends EventDispatcher {
45831
45831
 
@@ -45954,7 +45954,7 @@ class OrbitControls extends EventDispatcher {
45954
45954
  scope.object.zoom = scope.zoom0;
45955
45955
 
45956
45956
  scope.object.updateProjectionMatrix();
45957
- scope.dispatchEvent( _changeEvent$1 );
45957
+ scope.dispatchEvent( _changeEvent$2 );
45958
45958
 
45959
45959
  scope.update();
45960
45960
 
@@ -46088,7 +46088,7 @@ class OrbitControls extends EventDispatcher {
46088
46088
  lastPosition.distanceToSquared( scope.object.position ) > EPS ||
46089
46089
  8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS ) {
46090
46090
 
46091
- scope.dispatchEvent( _changeEvent$1 );
46091
+ scope.dispatchEvent( _changeEvent$2 );
46092
46092
 
46093
46093
  lastPosition.copy( scope.object.position );
46094
46094
  lastQuaternion.copy( scope.object.quaternion );
@@ -46702,7 +46702,7 @@ class OrbitControls extends EventDispatcher {
46702
46702
 
46703
46703
  }
46704
46704
 
46705
- scope.dispatchEvent( _endEvent$1 );
46705
+ scope.dispatchEvent( _endEvent$2 );
46706
46706
 
46707
46707
  state = STATE.NONE;
46708
46708
 
@@ -46799,7 +46799,7 @@ class OrbitControls extends EventDispatcher {
46799
46799
 
46800
46800
  if ( state !== STATE.NONE ) {
46801
46801
 
46802
- scope.dispatchEvent( _startEvent$1 );
46802
+ scope.dispatchEvent( _startEvent$2 );
46803
46803
 
46804
46804
  }
46805
46805
 
@@ -46843,11 +46843,11 @@ class OrbitControls extends EventDispatcher {
46843
46843
 
46844
46844
  event.preventDefault();
46845
46845
 
46846
- scope.dispatchEvent( _startEvent$1 );
46846
+ scope.dispatchEvent( _startEvent$2 );
46847
46847
 
46848
46848
  handleMouseWheel( event );
46849
46849
 
46850
- scope.dispatchEvent( _endEvent$1 );
46850
+ scope.dispatchEvent( _endEvent$2 );
46851
46851
 
46852
46852
  }
46853
46853
 
@@ -46937,7 +46937,7 @@ class OrbitControls extends EventDispatcher {
46937
46937
 
46938
46938
  if ( state !== STATE.NONE ) {
46939
46939
 
46940
- scope.dispatchEvent( _startEvent$1 );
46940
+ scope.dispatchEvent( _startEvent$2 );
46941
46941
 
46942
46942
  }
46943
46943
 
@@ -48356,6 +48356,543 @@ class baseRenderer {
48356
48356
  }
48357
48357
  }
48358
48358
 
48359
+ const _changeEvent$1 = { type: "change" };
48360
+ const _startEvent$1 = { type: "start" };
48361
+ const _endEvent$1 = { type: "end" };
48362
+ class Copper3dTrackballControls1 extends EventDispatcher {
48363
+ constructor(object, domElement) {
48364
+ super();
48365
+ const scope = this;
48366
+ const STATE = {
48367
+ NONE: -1,
48368
+ ROTATE: 0,
48369
+ ZOOM: 1,
48370
+ PAN: 2,
48371
+ TOUCH_ROTATE: 3,
48372
+ TOUCH_ZOOM: 4,
48373
+ TOUCH_PAN: 5,
48374
+ TOUCH_ZOOM_PAN: 6,
48375
+ };
48376
+ this.object = object;
48377
+ this.domElement = domElement;
48378
+ this.domElement.style.touchAction = "none"; // disable touch scroll
48379
+ // API
48380
+ this.enabled = true;
48381
+ this.screen = { left: 0, top: 0, width: 0, height: 0 };
48382
+ this.rotateSpeed = 1.0;
48383
+ this.zoomSpeed = 1.2;
48384
+ this.panSpeed = 0.3;
48385
+ this.noRotate = false;
48386
+ this.noZoom = false;
48387
+ this.noPan = false;
48388
+ this.staticMoving = false;
48389
+ this.dynamicDampingFactor = 0.2;
48390
+ this.minDistance = 0;
48391
+ this.maxDistance = Infinity;
48392
+ this.minZoom = 0;
48393
+ this.maxZoom = Infinity;
48394
+ this.keys = ["KeyA" /*A*/, "KeyS" /*S*/, "KeyD" /*D*/];
48395
+ this.mouseButtons = {
48396
+ LEFT: MOUSE.ROTATE,
48397
+ MIDDLE: MOUSE.DOLLY,
48398
+ RIGHT: MOUSE.PAN,
48399
+ };
48400
+ // internals
48401
+ this.target = new Vector3();
48402
+ const EPS = 0.000001;
48403
+ const lastPosition = new Vector3();
48404
+ let lastZoom = 1;
48405
+ let _state = STATE.NONE, _keyState = STATE.NONE, _touchZoomDistanceStart = 0, _touchZoomDistanceEnd = 0, _lastAngle = 0;
48406
+ const _eye = new Vector3(), _movePrev = new Vector2(), _moveCurr = new Vector2(), _lastAxis = new Vector3(), _zoomStart = new Vector2(), _zoomEnd = new Vector2(), _panStart = new Vector2(), _panEnd = new Vector2(), _pointers = [], _pointerPositions = {};
48407
+ // for reset
48408
+ this.target0 = this.target.clone();
48409
+ this.position0 = this.object.position.clone();
48410
+ this.up0 = this.object.up.clone();
48411
+ this.zoom0 = this.object.zoom;
48412
+ // methods
48413
+ this.handleResize = function () {
48414
+ const box = scope.domElement.getBoundingClientRect();
48415
+ // adjustments come from similar code in the jquery offset() function
48416
+ const d = scope.domElement.ownerDocument.documentElement;
48417
+ scope.screen.left = box.left + window.pageXOffset - d.clientLeft;
48418
+ scope.screen.top = box.top + window.pageYOffset - d.clientTop;
48419
+ scope.screen.width = box.width;
48420
+ scope.screen.height = box.height;
48421
+ };
48422
+ const getMouseOnScreen = (function () {
48423
+ const vector = new Vector2();
48424
+ return function getMouseOnScreen(pageX, pageY) {
48425
+ vector.set((pageX - scope.screen.left) / scope.screen.width, (pageY - scope.screen.top) / scope.screen.height);
48426
+ return vector;
48427
+ };
48428
+ })();
48429
+ const getMouseOnCircle = (function () {
48430
+ const vector = new Vector2();
48431
+ return function getMouseOnCircle(pageX, pageY) {
48432
+ vector.set((pageX - scope.screen.width * 0.5 - scope.screen.left) /
48433
+ (scope.screen.width * 0.5), (scope.screen.height + 2 * (scope.screen.top - pageY)) /
48434
+ scope.screen.width // screen.width intentional
48435
+ );
48436
+ return vector;
48437
+ };
48438
+ })();
48439
+ this.rotateCamera = (function () {
48440
+ const axis = new Vector3(), quaternion = new Quaternion(), eyeDirection = new Vector3(), objectUpDirection = new Vector3(), objectSidewaysDirection = new Vector3(), moveDirection = new Vector3();
48441
+ return function rotateCamera() {
48442
+ moveDirection.set(_moveCurr.x - _movePrev.x, _moveCurr.y - _movePrev.y, 0);
48443
+ let angle = moveDirection.length();
48444
+ if (angle) {
48445
+ _eye.copy(scope.object.position).sub(scope.target);
48446
+ eyeDirection.copy(_eye).normalize();
48447
+ objectUpDirection.copy(scope.object.up).normalize();
48448
+ objectSidewaysDirection
48449
+ .crossVectors(objectUpDirection, eyeDirection)
48450
+ .normalize();
48451
+ objectUpDirection.setLength(_moveCurr.y - _movePrev.y);
48452
+ objectSidewaysDirection.setLength(_moveCurr.x - _movePrev.x);
48453
+ moveDirection.copy(objectUpDirection.add(objectSidewaysDirection));
48454
+ axis.crossVectors(moveDirection, _eye).normalize();
48455
+ angle *= scope.rotateSpeed;
48456
+ quaternion.setFromAxisAngle(axis, angle);
48457
+ _eye.applyQuaternion(quaternion);
48458
+ scope.object.up.applyQuaternion(quaternion);
48459
+ _lastAxis.copy(axis);
48460
+ _lastAngle = angle;
48461
+ }
48462
+ else if (!scope.staticMoving && _lastAngle) {
48463
+ _lastAngle *= Math.sqrt(1.0 - scope.dynamicDampingFactor);
48464
+ _eye.copy(scope.object.position).sub(scope.target);
48465
+ quaternion.setFromAxisAngle(_lastAxis, _lastAngle);
48466
+ _eye.applyQuaternion(quaternion);
48467
+ scope.object.up.applyQuaternion(quaternion);
48468
+ }
48469
+ _movePrev.copy(_moveCurr);
48470
+ };
48471
+ })();
48472
+ this.zoomCamera = function () {
48473
+ let factor;
48474
+ if (_state === STATE.TOUCH_ZOOM_PAN) {
48475
+ factor = _touchZoomDistanceStart / _touchZoomDistanceEnd;
48476
+ _touchZoomDistanceStart = _touchZoomDistanceEnd;
48477
+ if (scope.object.isPerspectiveCamera) {
48478
+ _eye.multiplyScalar(factor);
48479
+ }
48480
+ else if (scope.object.isOrthographicCamera) {
48481
+ scope.object.zoom = MathUtils.clamp(scope.object.zoom / factor, scope.minZoom, scope.maxZoom);
48482
+ if (lastZoom !== scope.object.zoom) {
48483
+ scope.object.updateProjectionMatrix();
48484
+ }
48485
+ }
48486
+ else {
48487
+ console.warn("THREE.TrackballControls: Unsupported camera type");
48488
+ }
48489
+ }
48490
+ else {
48491
+ factor = 1.0 + (_zoomEnd.y - _zoomStart.y) * scope.zoomSpeed;
48492
+ if (factor !== 1.0 && factor > 0.0) {
48493
+ if (scope.object.isPerspectiveCamera) {
48494
+ _eye.multiplyScalar(factor);
48495
+ }
48496
+ else if (scope.object.isOrthographicCamera) {
48497
+ scope.object.zoom = MathUtils.clamp(scope.object.zoom / factor, scope.minZoom, scope.maxZoom);
48498
+ if (lastZoom !== scope.object.zoom) {
48499
+ scope.object.updateProjectionMatrix();
48500
+ }
48501
+ }
48502
+ else {
48503
+ console.warn("THREE.TrackballControls: Unsupported camera type");
48504
+ }
48505
+ }
48506
+ if (scope.staticMoving) {
48507
+ _zoomStart.copy(_zoomEnd);
48508
+ }
48509
+ else {
48510
+ _zoomStart.y +=
48511
+ (_zoomEnd.y - _zoomStart.y) * this.dynamicDampingFactor;
48512
+ }
48513
+ }
48514
+ };
48515
+ this.panCamera = (function () {
48516
+ const mouseChange = new Vector2(), objectUp = new Vector3(), pan = new Vector3();
48517
+ return function panCamera() {
48518
+ mouseChange.copy(_panEnd).sub(_panStart);
48519
+ if (mouseChange.lengthSq()) {
48520
+ if (scope.object.isOrthographicCamera) {
48521
+ const scale_x = (scope.object.right -
48522
+ scope.object.left) /
48523
+ scope.object.zoom /
48524
+ scope.domElement.clientWidth;
48525
+ const scale_y = (scope.object.top -
48526
+ scope.object.bottom) /
48527
+ scope.object.zoom /
48528
+ scope.domElement.clientWidth;
48529
+ mouseChange.x *= scale_x;
48530
+ mouseChange.y *= scale_y;
48531
+ }
48532
+ mouseChange.multiplyScalar(_eye.length() * scope.panSpeed);
48533
+ pan.copy(_eye).cross(scope.object.up).setLength(mouseChange.x);
48534
+ pan.add(objectUp.copy(scope.object.up).setLength(mouseChange.y));
48535
+ scope.object.position.add(pan);
48536
+ scope.target.add(pan);
48537
+ if (scope.staticMoving) {
48538
+ _panStart.copy(_panEnd);
48539
+ }
48540
+ else {
48541
+ _panStart.add(mouseChange
48542
+ .subVectors(_panEnd, _panStart)
48543
+ .multiplyScalar(scope.dynamicDampingFactor));
48544
+ }
48545
+ }
48546
+ };
48547
+ })();
48548
+ this.checkDistances = function () {
48549
+ if (!scope.noZoom || !scope.noPan) {
48550
+ if (_eye.lengthSq() > scope.maxDistance * scope.maxDistance) {
48551
+ scope.object.position.addVectors(scope.target, _eye.setLength(scope.maxDistance));
48552
+ _zoomStart.copy(_zoomEnd);
48553
+ }
48554
+ if (_eye.lengthSq() < scope.minDistance * scope.minDistance) {
48555
+ scope.object.position.addVectors(scope.target, _eye.setLength(scope.minDistance));
48556
+ _zoomStart.copy(_zoomEnd);
48557
+ }
48558
+ }
48559
+ };
48560
+ this.update = function () {
48561
+ _eye.subVectors(scope.object.position, scope.target);
48562
+ if (!scope.noRotate) {
48563
+ scope.rotateCamera();
48564
+ }
48565
+ if (!scope.noZoom) {
48566
+ scope.zoomCamera();
48567
+ }
48568
+ if (!scope.noPan) {
48569
+ scope.panCamera();
48570
+ }
48571
+ scope.object.position.addVectors(scope.target, _eye);
48572
+ if (scope.object.isPerspectiveCamera) {
48573
+ scope.checkDistances();
48574
+ scope.object.lookAt(scope.target);
48575
+ if (lastPosition.distanceToSquared(scope.object.position) > EPS) {
48576
+ scope.dispatchEvent(_changeEvent$1);
48577
+ lastPosition.copy(scope.object.position);
48578
+ }
48579
+ }
48580
+ else if (scope.object.isOrthographicCamera) {
48581
+ scope.object.lookAt(scope.target);
48582
+ if (lastPosition.distanceToSquared(scope.object.position) > EPS ||
48583
+ lastZoom !== scope.object.zoom) {
48584
+ scope.dispatchEvent(_changeEvent$1);
48585
+ lastPosition.copy(scope.object.position);
48586
+ lastZoom = scope.object.zoom;
48587
+ }
48588
+ }
48589
+ else {
48590
+ console.warn("THREE.TrackballControls: Unsupported camera type");
48591
+ }
48592
+ };
48593
+ this.reset = function () {
48594
+ _state = STATE.NONE;
48595
+ _keyState = STATE.NONE;
48596
+ scope.target.copy(scope.target0);
48597
+ scope.object.position.copy(scope.position0);
48598
+ scope.object.up.copy(scope.up0);
48599
+ scope.object.zoom = scope.zoom0;
48600
+ scope.object.updateProjectionMatrix();
48601
+ _eye.subVectors(scope.object.position, scope.target);
48602
+ scope.object.lookAt(scope.target);
48603
+ scope.dispatchEvent(_changeEvent$1);
48604
+ lastPosition.copy(scope.object.position);
48605
+ lastZoom = scope.object.zoom;
48606
+ };
48607
+ // listeners
48608
+ function onPointerDown(event) {
48609
+ if (scope.enabled === false)
48610
+ return;
48611
+ if (_pointers.length === 0) {
48612
+ scope.domElement.setPointerCapture(event.pointerId);
48613
+ scope.domElement.addEventListener("pointermove", onPointerMove);
48614
+ scope.domElement.addEventListener("pointerup", onPointerUp);
48615
+ }
48616
+ //
48617
+ addPointer(event);
48618
+ if (event.pointerType === "touch") {
48619
+ onTouchStart(event);
48620
+ }
48621
+ else {
48622
+ onMouseDown(event);
48623
+ }
48624
+ }
48625
+ function onPointerMove(event) {
48626
+ if (scope.enabled === false)
48627
+ return;
48628
+ if (event.pointerType === "touch") {
48629
+ onTouchMove(event);
48630
+ }
48631
+ else {
48632
+ onMouseMove(event);
48633
+ }
48634
+ }
48635
+ function onPointerUp(event) {
48636
+ if (scope.enabled === false)
48637
+ return;
48638
+ if (event.pointerType === "touch") {
48639
+ onTouchEnd(event);
48640
+ }
48641
+ else {
48642
+ onMouseUp();
48643
+ }
48644
+ //
48645
+ removePointer(event);
48646
+ if (_pointers.length === 0) {
48647
+ scope.domElement.releasePointerCapture(event.pointerId);
48648
+ scope.domElement.removeEventListener("pointermove", onPointerMove);
48649
+ scope.domElement.removeEventListener("pointerup", onPointerUp);
48650
+ }
48651
+ }
48652
+ function onPointerCancel(event) {
48653
+ removePointer(event);
48654
+ }
48655
+ function keydown(event) {
48656
+ if (scope.enabled === false)
48657
+ return;
48658
+ window.removeEventListener("keydown", keydown);
48659
+ if (_keyState !== STATE.NONE) {
48660
+ return;
48661
+ }
48662
+ else if (event.code === scope.keys[STATE.ROTATE] && !scope.noRotate) {
48663
+ _keyState = STATE.ROTATE;
48664
+ }
48665
+ else if (event.code === scope.keys[STATE.ZOOM] && !scope.noZoom) {
48666
+ _keyState = STATE.ZOOM;
48667
+ }
48668
+ else if (event.code === scope.keys[STATE.PAN] && !scope.noPan) {
48669
+ _keyState = STATE.PAN;
48670
+ }
48671
+ }
48672
+ function keyup() {
48673
+ if (scope.enabled === false)
48674
+ return;
48675
+ _keyState = STATE.NONE;
48676
+ window.addEventListener("keydown", keydown);
48677
+ }
48678
+ function onMouseDown(event) {
48679
+ if (_state === STATE.NONE) {
48680
+ switch (event.button) {
48681
+ case scope.mouseButtons.LEFT:
48682
+ _state = STATE.ROTATE;
48683
+ break;
48684
+ case scope.mouseButtons.MIDDLE:
48685
+ _state = STATE.ZOOM;
48686
+ break;
48687
+ case scope.mouseButtons.RIGHT:
48688
+ _state = STATE.PAN;
48689
+ break;
48690
+ }
48691
+ }
48692
+ const state = _keyState !== STATE.NONE ? _keyState : _state;
48693
+ if (state === STATE.ROTATE && !scope.noRotate) {
48694
+ _moveCurr.copy(getMouseOnCircle(event.pageX, event.pageY));
48695
+ _movePrev.copy(_moveCurr);
48696
+ }
48697
+ else if (state === STATE.ZOOM && !scope.noZoom) {
48698
+ _zoomStart.copy(getMouseOnScreen(event.pageX, event.pageY));
48699
+ _zoomEnd.copy(_zoomStart);
48700
+ }
48701
+ else if (state === STATE.PAN && !scope.noPan) {
48702
+ _panStart.copy(getMouseOnScreen(event.pageX, event.pageY));
48703
+ _panEnd.copy(_panStart);
48704
+ }
48705
+ scope.dispatchEvent(_startEvent$1);
48706
+ }
48707
+ function onMouseMove(event) {
48708
+ const state = _keyState !== STATE.NONE ? _keyState : _state;
48709
+ if (state === STATE.ROTATE && !scope.noRotate) {
48710
+ _movePrev.copy(_moveCurr);
48711
+ _moveCurr.copy(getMouseOnCircle(event.pageX, event.pageY));
48712
+ }
48713
+ else if (state === STATE.ZOOM && !scope.noZoom) {
48714
+ _zoomEnd.copy(getMouseOnScreen(event.pageX, event.pageY));
48715
+ }
48716
+ else if (state === STATE.PAN && !scope.noPan) {
48717
+ _panEnd.copy(getMouseOnScreen(event.pageX, event.pageY));
48718
+ }
48719
+ }
48720
+ function onMouseUp() {
48721
+ _state = STATE.NONE;
48722
+ scope.dispatchEvent(_endEvent$1);
48723
+ }
48724
+ function onMouseWheel(event) {
48725
+ if (scope.enabled === false)
48726
+ return;
48727
+ if (scope.noZoom === true)
48728
+ return;
48729
+ event.preventDefault();
48730
+ switch (event.deltaMode) {
48731
+ case 2:
48732
+ // Zoom in pages
48733
+ _zoomStart.y -= event.deltaY * 0.025;
48734
+ break;
48735
+ case 1:
48736
+ // Zoom in lines
48737
+ _zoomStart.y -= event.deltaY * 0.01;
48738
+ break;
48739
+ default:
48740
+ // undefined, 0, assume pixels
48741
+ _zoomStart.y -= event.deltaY * 0.00025;
48742
+ break;
48743
+ }
48744
+ scope.dispatchEvent(_startEvent$1);
48745
+ scope.dispatchEvent(_endEvent$1);
48746
+ }
48747
+ function onTouchStart(event) {
48748
+ trackPointer(event);
48749
+ switch (_pointers.length) {
48750
+ case 1:
48751
+ _state = STATE.TOUCH_ROTATE;
48752
+ _moveCurr.copy(getMouseOnCircle(_pointers[0].pageX, _pointers[0].pageY));
48753
+ _movePrev.copy(_moveCurr);
48754
+ break;
48755
+ case 2:
48756
+ _state = STATE.TOUCH_ZOOM_PAN;
48757
+ const dx = _pointers[0].pageX - _pointers[1].pageX;
48758
+ const dy = _pointers[0].pageY - _pointers[1].pageY;
48759
+ _touchZoomDistanceEnd = _touchZoomDistanceStart = Math.sqrt(dx * dx + dy * dy);
48760
+ const x = (_pointers[0].pageX + _pointers[1].pageX) / 2;
48761
+ const y = (_pointers[0].pageY + _pointers[1].pageY) / 2;
48762
+ _panStart.copy(getMouseOnScreen(x, y));
48763
+ _panEnd.copy(_panStart);
48764
+ break;
48765
+ case 3:
48766
+ _state = STATE.TOUCH_PAN;
48767
+ const centerX = (_pointers[0].pageX + _pointers[1].pageX + _pointers[2].pageX) / 3;
48768
+ const centerY = (_pointers[0].pageY + _pointers[1].pageY + _pointers[2].pageY) / 3;
48769
+ _panStart.copy(getMouseOnScreen(centerX, centerY));
48770
+ _panEnd.copy(_panStart);
48771
+ break;
48772
+ }
48773
+ scope.dispatchEvent(_startEvent$1);
48774
+ }
48775
+ function onTouchMove(event) {
48776
+ trackPointer(event);
48777
+ let position, x, y;
48778
+ switch (_pointers.length) {
48779
+ case 1:
48780
+ if (_state != STATE.TOUCH_ROTATE)
48781
+ return;
48782
+ _movePrev.copy(_moveCurr);
48783
+ _moveCurr.copy(getMouseOnCircle(event.pageX, event.pageY));
48784
+ break;
48785
+ case 2:
48786
+ if (_state != STATE.TOUCH_ZOOM_PAN)
48787
+ return;
48788
+ position = getSecondPointerPosition(event);
48789
+ const dx = event.pageX - position.x;
48790
+ const dy = event.pageY - position.y;
48791
+ _touchZoomDistanceEnd = Math.sqrt(dx * dx + dy * dy);
48792
+ x = (event.pageX + position.x) / 2;
48793
+ y = (event.pageY + position.y) / 2;
48794
+ _panEnd.copy(getMouseOnScreen(x, y));
48795
+ break;
48796
+ case 3:
48797
+ if (_state != STATE.TOUCH_PAN)
48798
+ return;
48799
+ const point_1 = _pointerPositions[_pointers[0].pointerId];
48800
+ const point_2 = _pointerPositions[_pointers[1].pointerId];
48801
+ const point_3 = _pointerPositions[_pointers[2].pointerId];
48802
+ const centerX = (point_1.x + point_2.x + point_3.x) / 3;
48803
+ const centerY = (point_1.y + point_2.y + point_3.y) / 3;
48804
+ _panEnd.copy(getMouseOnScreen(centerX, centerY));
48805
+ break;
48806
+ }
48807
+ }
48808
+ function onTouchEnd(event) {
48809
+ switch (_pointers.length) {
48810
+ case 0:
48811
+ _state = STATE.NONE;
48812
+ break;
48813
+ case 1:
48814
+ _state = STATE.TOUCH_ROTATE;
48815
+ _moveCurr.copy(getMouseOnCircle(event.pageX, event.pageY));
48816
+ _movePrev.copy(_moveCurr);
48817
+ break;
48818
+ case 2:
48819
+ _state = STATE.TOUCH_ZOOM_PAN;
48820
+ for (let i = 0; i < _pointers.length; i++) {
48821
+ if (_pointers[i].pointerId !== event.pointerId) {
48822
+ const position = _pointerPositions[_pointers[i].pointerId];
48823
+ _moveCurr.copy(getMouseOnScreen(position.x, position.y));
48824
+ _movePrev.copy(_moveCurr);
48825
+ break;
48826
+ }
48827
+ }
48828
+ break;
48829
+ case 3:
48830
+ _state = STATE.TOUCH_PAN;
48831
+ for (let i = 0; i < _pointers.length; i++) {
48832
+ if (_pointers[i].pointerId !== event.pointerId) {
48833
+ const position = _pointerPositions[_pointers[i].pointerId];
48834
+ _moveCurr.copy(getMouseOnScreen(position.x, position.y));
48835
+ _movePrev.copy(_moveCurr);
48836
+ break;
48837
+ }
48838
+ }
48839
+ break;
48840
+ }
48841
+ scope.dispatchEvent(_endEvent$1);
48842
+ }
48843
+ function contextmenu(event) {
48844
+ if (scope.enabled === false)
48845
+ return;
48846
+ event.preventDefault();
48847
+ }
48848
+ function addPointer(event) {
48849
+ _pointers.push(event);
48850
+ }
48851
+ function removePointer(event) {
48852
+ delete _pointerPositions[event.pointerId];
48853
+ for (let i = 0; i < _pointers.length; i++) {
48854
+ if (_pointers[i].pointerId == event.pointerId) {
48855
+ _pointers.splice(i, 1);
48856
+ return;
48857
+ }
48858
+ }
48859
+ }
48860
+ function trackPointer(event) {
48861
+ let position = _pointerPositions[event.pointerId];
48862
+ if (position === undefined) {
48863
+ position = new Vector2();
48864
+ _pointerPositions[event.pointerId] = position;
48865
+ }
48866
+ position.set(event.pageX, event.pageY);
48867
+ }
48868
+ function getSecondPointerPosition(event) {
48869
+ const pointer = event.pointerId === _pointers[0].pointerId
48870
+ ? _pointers[1]
48871
+ : _pointers[0];
48872
+ return _pointerPositions[pointer.pointerId];
48873
+ }
48874
+ this.dispose = function () {
48875
+ scope.domElement.removeEventListener("contextmenu", contextmenu);
48876
+ scope.domElement.removeEventListener("pointerdown", onPointerDown);
48877
+ scope.domElement.removeEventListener("pointercancel", onPointerCancel);
48878
+ scope.domElement.removeEventListener("wheel", onMouseWheel);
48879
+ scope.domElement.removeEventListener("pointermove", onPointerMove);
48880
+ scope.domElement.removeEventListener("pointerup", onPointerUp);
48881
+ window.removeEventListener("keydown", keydown);
48882
+ window.removeEventListener("keyup", keyup);
48883
+ };
48884
+ this.domElement.addEventListener("contextmenu", contextmenu);
48885
+ this.domElement.addEventListener("pointerdown", onPointerDown);
48886
+ this.domElement.addEventListener("pointercancel", onPointerCancel);
48887
+ this.domElement.addEventListener("wheel", onMouseWheel, { passive: false });
48888
+ window.addEventListener("keydown", keydown);
48889
+ window.addEventListener("keyup", keyup);
48890
+ this.handleResize();
48891
+ // force an update at start
48892
+ this.update();
48893
+ }
48894
+ }
48895
+
48359
48896
  /**
48360
48897
  * @param {BufferGeometry} geometry
48361
48898
  * @param {number} drawMode
@@ -56334,7 +56871,7 @@ class copperScene extends baseScene {
56334
56871
  this.controls = new OrbitControls(this.camera, this.renderer.domElement);
56335
56872
  }
56336
56873
  else {
56337
- this.controls = new Copper3dTrackballControls(this.camera, this.renderer.domElement);
56874
+ this.controls = new Copper3dTrackballControls1(this.camera, this.renderer.domElement);
56338
56875
  }
56339
56876
  this.controls.panSpeed = 3;
56340
56877
  this.controls.rotateSpeed = 3;