copper3d 1.15.5 → 1.15.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.
@@ -45217,9 +45217,9 @@
45217
45217
 
45218
45218
  const objLoader = new OBJLoader();
45219
45219
 
45220
- const _changeEvent$3 = { type: "change" };
45221
- const _startEvent$3 = { type: "start" };
45222
- const _endEvent$3 = { type: "end" };
45220
+ const _changeEvent$2 = { type: "change" };
45221
+ const _startEvent$2 = { type: "start" };
45222
+ const _endEvent$2 = { type: "end" };
45223
45223
  class Copper3dTrackballControls extends EventDispatcher {
45224
45224
  constructor(object, domElement) {
45225
45225
  super();
@@ -45252,7 +45252,7 @@
45252
45252
  this.maxDistance = Infinity;
45253
45253
  this.minZoom = 0;
45254
45254
  this.maxZoom = Infinity;
45255
- this.keys = ["KeyA", "KeyS", "KeyD"];
45255
+ this.keys = ["KeyA" /*A*/, "KeyS" /*S*/, "KeyD" /*D*/];
45256
45256
  this.mouseButtons = {
45257
45257
  LEFT: MOUSE.ROTATE,
45258
45258
  MIDDLE: MOUSE.DOLLY,
@@ -45270,11 +45270,10 @@
45270
45270
  this.position0 = this.object.position.clone();
45271
45271
  this.up0 = this.object.up.clone();
45272
45272
  this.zoom0 = this.object.zoom;
45273
- // core methods
45273
+ // methods
45274
45274
  this.handleResize = function () {
45275
45275
  const box = scope.domElement.getBoundingClientRect();
45276
- // adjustments come from similar code in the jquery offser() function
45277
- // get root element
45276
+ // adjustments come from similar code in the jquery offset() function
45278
45277
  const d = scope.domElement.ownerDocument.documentElement;
45279
45278
  scope.screen.left = box.left + window.pageXOffset - d.clientLeft;
45280
45279
  scope.screen.top = box.top + window.pageYOffset - d.clientTop;
@@ -45289,18 +45288,11 @@
45289
45288
  };
45290
45289
  })();
45291
45290
  const getMouseOnCircle = (function () {
45292
- /**
45293
- * convert screen coordinates to threejs coordinates ratio
45294
- */
45295
45291
  const vector = new Vector2();
45296
- return function getMouseonCircle(pageX, pageY) {
45297
- vector.set(
45298
- // the width radius of the circle diameter
45299
- (pageX - scope.screen.width * 0.5 - scope.screen.left) /
45300
- (scope.screen.width * 0.5),
45301
- // the height radius of the circle diameter
45302
- (scope.screen.height + 2 * (scope.screen.top - pageY)) /
45303
- scope.screen.width //screen.width intentional
45292
+ return function getMouseOnCircle(pageX, pageY) {
45293
+ vector.set((pageX - scope.screen.width * 0.5 - scope.screen.left) /
45294
+ (scope.screen.width * 0.5), (scope.screen.height + 2 * (scope.screen.top - pageY)) /
45295
+ scope.screen.width // screen.width intentional
45304
45296
  );
45305
45297
  return vector;
45306
45298
  };
@@ -45309,26 +45301,20 @@
45309
45301
  const axis = new Vector3(), quaternion = new Quaternion(), eyeDirection = new Vector3(), objectUpDirection = new Vector3(), objectSidewaysDirection = new Vector3(), moveDirection = new Vector3();
45310
45302
  return function rotateCamera() {
45311
45303
  moveDirection.set(_moveCurr.x - _movePrev.x, _moveCurr.y - _movePrev.y, 0);
45312
- // Computes the Euclidean length (straight-line length) from (0, 0, 0) to (x, y, z).
45313
45304
  let angle = moveDirection.length();
45314
45305
  if (angle) {
45315
- // .sub Subtracts v from this vector.
45316
45306
  _eye.copy(scope.object.position).sub(scope.target);
45317
- // .normalize() Convert this vector to a unit vector - that is, sets it equal to a vector with the same direction as this one, but length 1.
45318
45307
  eyeDirection.copy(_eye).normalize();
45319
45308
  objectUpDirection.copy(scope.object.up).normalize();
45320
- // .crossVectors Sets this vector to cross product of a and b.
45321
45309
  objectSidewaysDirection
45322
45310
  .crossVectors(objectUpDirection, eyeDirection)
45323
45311
  .normalize();
45324
- // .setLength Set this vector to a vector with the same direction as this one, but length l.
45325
45312
  objectUpDirection.setLength(_moveCurr.y - _movePrev.y);
45326
45313
  objectSidewaysDirection.setLength(_moveCurr.x - _movePrev.x);
45327
45314
  moveDirection.copy(objectUpDirection.add(objectSidewaysDirection));
45328
45315
  axis.crossVectors(moveDirection, _eye).normalize();
45329
45316
  angle *= scope.rotateSpeed;
45330
45317
  quaternion.setFromAxisAngle(axis, angle);
45331
- // Applies a Quaternion transform to this vector.
45332
45318
  _eye.applyQuaternion(quaternion);
45333
45319
  scope.object.up.applyQuaternion(quaternion);
45334
45320
  _lastAxis.copy(axis);
@@ -45383,15 +45369,15 @@
45383
45369
  const mouseChange = new Vector2(), objectUp = new Vector3(), pan = new Vector3();
45384
45370
  return function panCamera() {
45385
45371
  mouseChange.copy(_panEnd).sub(_panStart);
45386
- // .lengthSq() Computes the squared length of this vector. If you are comparing the lengths of vectors, you should compare the length squared instead as it is slightly more efficient to calculate.
45387
45372
  if (mouseChange.lengthSq()) {
45388
45373
  if (scope.object.isOrthographicCamera) {
45389
- const orth_camera = scope.object;
45390
- const scale_x = (orth_camera.right - orth_camera.left) /
45391
- orth_camera.zoom /
45374
+ const scale_x = (scope.object.right -
45375
+ scope.object.left) /
45376
+ scope.object.zoom /
45392
45377
  scope.domElement.clientWidth;
45393
- const scale_y = (orth_camera.top - orth_camera.bottom) /
45394
- orth_camera.zoom /
45378
+ const scale_y = (scope.object.top -
45379
+ scope.object.bottom) /
45380
+ scope.object.zoom /
45395
45381
  scope.domElement.clientWidth;
45396
45382
  mouseChange.x *= scale_x;
45397
45383
  mouseChange.y *= scale_y;
@@ -45440,7 +45426,7 @@
45440
45426
  scope.checkDistances();
45441
45427
  scope.object.lookAt(scope.target);
45442
45428
  if (lastPosition.distanceToSquared(scope.object.position) > EPS) {
45443
- scope.dispatchEvent(_changeEvent$3);
45429
+ scope.dispatchEvent(_changeEvent$2);
45444
45430
  lastPosition.copy(scope.object.position);
45445
45431
  }
45446
45432
  }
@@ -45448,7 +45434,7 @@
45448
45434
  scope.object.lookAt(scope.target);
45449
45435
  if (lastPosition.distanceToSquared(scope.object.position) > EPS ||
45450
45436
  lastZoom !== scope.object.zoom) {
45451
- scope.dispatchEvent(_changeEvent$3);
45437
+ scope.dispatchEvent(_changeEvent$2);
45452
45438
  lastPosition.copy(scope.object.position);
45453
45439
  lastZoom = scope.object.zoom;
45454
45440
  }
@@ -45467,7 +45453,7 @@
45467
45453
  scope.object.updateProjectionMatrix();
45468
45454
  _eye.subVectors(scope.object.position, scope.target);
45469
45455
  scope.object.lookAt(scope.target);
45470
- scope.dispatchEvent(_changeEvent$3);
45456
+ scope.dispatchEvent(_changeEvent$2);
45471
45457
  lastPosition.copy(scope.object.position);
45472
45458
  lastZoom = scope.object.zoom;
45473
45459
  };
@@ -45477,9 +45463,10 @@
45477
45463
  return;
45478
45464
  if (_pointers.length === 0) {
45479
45465
  scope.domElement.setPointerCapture(event.pointerId);
45480
- scope.domElement.addEventListener("pointermove", onPointerMove, false);
45481
- scope.domElement.addEventListener("pointerup", onPointerUp, false);
45466
+ scope.domElement.addEventListener("pointermove", onPointerMove);
45467
+ scope.domElement.addEventListener("pointerup", onPointerUp);
45482
45468
  }
45469
+ //
45483
45470
  addPointer(event);
45484
45471
  if (event.pointerType === "touch") {
45485
45472
  onTouchStart(event);
@@ -45507,11 +45494,12 @@
45507
45494
  else {
45508
45495
  onMouseUp();
45509
45496
  }
45497
+ //
45510
45498
  removePointer(event);
45511
45499
  if (_pointers.length === 0) {
45512
45500
  scope.domElement.releasePointerCapture(event.pointerId);
45513
- scope.domElement.removeEventListener("pointermove", onPointerMove, false);
45514
- scope.domElement.removeEventListener("pointerup", onPointerUp, false);
45501
+ scope.domElement.removeEventListener("pointermove", onPointerMove);
45502
+ scope.domElement.removeEventListener("pointerup", onPointerUp);
45515
45503
  }
45516
45504
  }
45517
45505
  function onPointerCancel(event) {
@@ -45534,11 +45522,11 @@
45534
45522
  _keyState = STATE.PAN;
45535
45523
  }
45536
45524
  }
45537
- function keyup(event) {
45525
+ function keyup() {
45538
45526
  if (scope.enabled === false)
45539
45527
  return;
45540
45528
  _keyState = STATE.NONE;
45541
- window.addEventListener("keydown", keydown, false);
45529
+ window.addEventListener("keydown", keydown);
45542
45530
  }
45543
45531
  function onMouseDown(event) {
45544
45532
  if (_state === STATE.NONE) {
@@ -45567,7 +45555,7 @@
45567
45555
  _panStart.copy(getMouseOnScreen(event.pageX, event.pageY));
45568
45556
  _panEnd.copy(_panStart);
45569
45557
  }
45570
- scope.dispatchEvent(_startEvent$3);
45558
+ scope.dispatchEvent(_startEvent$2);
45571
45559
  }
45572
45560
  function onMouseMove(event) {
45573
45561
  const state = _keyState !== STATE.NONE ? _keyState : _state;
@@ -45582,9 +45570,9 @@
45582
45570
  _panEnd.copy(getMouseOnScreen(event.pageX, event.pageY));
45583
45571
  }
45584
45572
  }
45585
- function onMouseUp(event) {
45573
+ function onMouseUp() {
45586
45574
  _state = STATE.NONE;
45587
- scope.dispatchEvent(_endEvent$3);
45575
+ scope.dispatchEvent(_endEvent$2);
45588
45576
  }
45589
45577
  function onMouseWheel(event) {
45590
45578
  if (scope.enabled === false)
@@ -45606,8 +45594,8 @@
45606
45594
  _zoomStart.y -= event.deltaY * 0.00025;
45607
45595
  break;
45608
45596
  }
45609
- scope.dispatchEvent(_startEvent$3);
45610
- scope.dispatchEvent(_endEvent$3);
45597
+ scope.dispatchEvent(_startEvent$2);
45598
+ scope.dispatchEvent(_endEvent$2);
45611
45599
  }
45612
45600
  function onTouchStart(event) {
45613
45601
  trackPointer(event);
@@ -45617,7 +45605,7 @@
45617
45605
  _moveCurr.copy(getMouseOnCircle(_pointers[0].pageX, _pointers[0].pageY));
45618
45606
  _movePrev.copy(_moveCurr);
45619
45607
  break;
45620
- default: // 2 or more
45608
+ case 2:
45621
45609
  _state = STATE.TOUCH_ZOOM_PAN;
45622
45610
  const dx = _pointers[0].pageX - _pointers[1].pageX;
45623
45611
  const dy = _pointers[0].pageY - _pointers[1].pageY;
@@ -45627,25 +45615,47 @@
45627
45615
  _panStart.copy(getMouseOnScreen(x, y));
45628
45616
  _panEnd.copy(_panStart);
45629
45617
  break;
45618
+ case 3:
45619
+ _state = STATE.TOUCH_PAN;
45620
+ const centerX = (_pointers[0].pageX + _pointers[1].pageX + _pointers[2].pageX) / 3;
45621
+ const centerY = (_pointers[0].pageY + _pointers[1].pageY + _pointers[2].pageY) / 3;
45622
+ _panStart.copy(getMouseOnScreen(centerX, centerY));
45623
+ _panEnd.copy(_panStart);
45624
+ break;
45630
45625
  }
45631
- scope.dispatchEvent(_startEvent$3);
45626
+ scope.dispatchEvent(_startEvent$2);
45632
45627
  }
45633
45628
  function onTouchMove(event) {
45634
45629
  trackPointer(event);
45630
+ let position, x, y;
45635
45631
  switch (_pointers.length) {
45636
45632
  case 1:
45633
+ if (_state != STATE.TOUCH_ROTATE)
45634
+ return;
45637
45635
  _movePrev.copy(_moveCurr);
45638
45636
  _moveCurr.copy(getMouseOnCircle(event.pageX, event.pageY));
45639
45637
  break;
45640
- default: // 2 or more
45641
- const position = getSecondPointerPosition(event);
45638
+ case 2:
45639
+ if (_state != STATE.TOUCH_ZOOM_PAN)
45640
+ return;
45641
+ position = getSecondPointerPosition(event);
45642
45642
  const dx = event.pageX - position.x;
45643
45643
  const dy = event.pageY - position.y;
45644
45644
  _touchZoomDistanceEnd = Math.sqrt(dx * dx + dy * dy);
45645
- const x = (event.pageX + position.x) / 2;
45646
- const y = (event.pageY + position.y) / 2;
45645
+ x = (event.pageX + position.x) / 2;
45646
+ y = (event.pageY + position.y) / 2;
45647
45647
  _panEnd.copy(getMouseOnScreen(x, y));
45648
45648
  break;
45649
+ case 3:
45650
+ if (_state != STATE.TOUCH_PAN)
45651
+ return;
45652
+ const point_1 = _pointerPositions[_pointers[0].pointerId];
45653
+ const point_2 = _pointerPositions[_pointers[1].pointerId];
45654
+ const point_3 = _pointerPositions[_pointers[2].pointerId];
45655
+ const centerX = (point_1.x + point_2.x + point_3.x) / 3;
45656
+ const centerY = (point_1.y + point_2.y + point_3.y) / 3;
45657
+ _panEnd.copy(getMouseOnScreen(centerX, centerY));
45658
+ break;
45649
45659
  }
45650
45660
  }
45651
45661
  function onTouchEnd(event) {
@@ -45663,114 +45673,26 @@
45663
45673
  for (let i = 0; i < _pointers.length; i++) {
45664
45674
  if (_pointers[i].pointerId !== event.pointerId) {
45665
45675
  const position = _pointerPositions[_pointers[i].pointerId];
45666
- _moveCurr.copy(getMouseOnCircle(position.x, position.y));
45676
+ _moveCurr.copy(getMouseOnScreen(position.x, position.y));
45677
+ _movePrev.copy(_moveCurr);
45678
+ break;
45679
+ }
45680
+ }
45681
+ break;
45682
+ case 3:
45683
+ _state = STATE.TOUCH_PAN;
45684
+ for (let i = 0; i < _pointers.length; i++) {
45685
+ if (_pointers[i].pointerId !== event.pointerId) {
45686
+ const position = _pointerPositions[_pointers[i].pointerId];
45687
+ _moveCurr.copy(getMouseOnScreen(position.x, position.y));
45667
45688
  _movePrev.copy(_moveCurr);
45668
45689
  break;
45669
45690
  }
45670
45691
  }
45671
45692
  break;
45672
45693
  }
45673
- scope.dispatchEvent(_endEvent$3);
45694
+ scope.dispatchEvent(_endEvent$2);
45674
45695
  }
45675
- // function onTouchStart(event: PointerEvent) {
45676
- // trackPointer(event);
45677
- // switch (_pointers.length) {
45678
- // case 1:
45679
- // _state = STATE.TOUCH_ROTATE;
45680
- // _moveCurr.copy(
45681
- // getMouseOnCircle(_pointers[0].pageX, _pointers[0].pageY)
45682
- // );
45683
- // _movePrev.copy(_moveCurr);
45684
- // break;
45685
- // case 2:
45686
- // _state = STATE.TOUCH_ZOOM_PAN;
45687
- // const dx: number = _pointers[0].pageX - _pointers[1].pageX;
45688
- // const dy: number = _pointers[0].pageY - _pointers[1].pageY;
45689
- // _touchZoomDistanceEnd = _touchZoomDistanceStart = Math.sqrt(
45690
- // dx * dx + dy * dy
45691
- // );
45692
- // const x = (_pointers[0].pageX + _pointers[1].pageX) / 2;
45693
- // const y = (_pointers[0].pageY + _pointers[1].pageY) / 2;
45694
- // _panStart.copy(getMouseOnScreen(x, y));
45695
- // _panEnd.copy(_panStart);
45696
- // break;
45697
- // case 3:
45698
- // _state = STATE.TOUCH_PAN;
45699
- // const centerX =
45700
- // (_pointers[0].pageX + _pointers[1].pageX + _pointers[2].pageX) / 3;
45701
- // const centerY =
45702
- // (_pointers[0].pageY + _pointers[1].pageY + _pointers[2].pageY) / 3;
45703
- // _panStart.copy(getMouseOnScreen(centerX, centerY));
45704
- // _panEnd.copy(_panStart);
45705
- // break;
45706
- // }
45707
- // scope.dispatchEvent(_startEvent);
45708
- // }
45709
- // function onTouchMove(event: PointerEvent) {
45710
- // trackPointer(event);
45711
- // let position: Vector2, x: number, y: number;
45712
- // switch (_pointers.length) {
45713
- // case 1:
45714
- // if (_state != STATE.TOUCH_ROTATE) return;
45715
- // _movePrev.copy(_moveCurr);
45716
- // _moveCurr.copy(getMouseOnCircle(event.pageX, event.pageY));
45717
- // break;
45718
- // case 2:
45719
- // if (_state != STATE.TOUCH_ZOOM_PAN) return;
45720
- // position = getSecondPointerPosition(event);
45721
- // const dx: number = event.pageX - position.x;
45722
- // const dy: number = event.pageY - position.y;
45723
- // _touchZoomDistanceEnd = Math.sqrt(dx * dx + dy * dy);
45724
- // x = (event.pageX + position.x) / 2;
45725
- // y = (event.pageY + position.y) / 2;
45726
- // _panEnd.copy(getMouseOnScreen(x, y));
45727
- // break;
45728
- // case 3:
45729
- // if (_state != STATE.TOUCH_PAN) return;
45730
- // const point_1 = _pointerPositions[_pointers[0].pointerId];
45731
- // const point_2 = _pointerPositions[_pointers[1].pointerId];
45732
- // const point_3 = _pointerPositions[_pointers[2].pointerId];
45733
- // const centerX = (point_1.x + point_2.x + point_3.x) / 3;
45734
- // const centerY = (point_1.y + point_2.y + point_3.y) / 3;
45735
- // _panEnd.copy(getMouseOnScreen(centerX, centerY));
45736
- // break;
45737
- // }
45738
- // }
45739
- // function onTouchEnd(event: PointerEvent) {
45740
- // switch (_pointers.length) {
45741
- // case 0:
45742
- // _state = STATE.NONE;
45743
- // break;
45744
- // case 1:
45745
- // _state = STATE.TOUCH_ROTATE;
45746
- // _moveCurr.copy(getMouseOnCircle(event.pageX, event.pageY));
45747
- // _movePrev.copy(_moveCurr);
45748
- // break;
45749
- // case 2:
45750
- // _state = STATE.TOUCH_ZOOM_PAN;
45751
- // for (let i = 0; i < _pointers.length; i++) {
45752
- // if (_pointers[i].pointerId !== event.pointerId) {
45753
- // const position = _pointerPositions[_pointers[i].pointerId];
45754
- // _moveCurr.copy(getMouseOnScreen(position.x, position.y));
45755
- // _movePrev.copy(_moveCurr);
45756
- // break;
45757
- // }
45758
- // }
45759
- // break;
45760
- // case 3:
45761
- // _state = STATE.TOUCH_PAN;
45762
- // for (let i = 0; i < _pointers.length; i++) {
45763
- // if (_pointers[i].pointerId !== event.pointerId) {
45764
- // const position = _pointerPositions[_pointers[i].pointerId];
45765
- // _moveCurr.copy(getMouseOnScreen(position.x, position.y));
45766
- // _movePrev.copy(_moveCurr);
45767
- // break;
45768
- // }
45769
- // }
45770
- // break;
45771
- // }
45772
- // scope.dispatchEvent(_endEvent);
45773
- // }
45774
45696
  function contextmenu(event) {
45775
45697
  if (scope.enabled === false)
45776
45698
  return;
@@ -45782,7 +45704,7 @@
45782
45704
  function removePointer(event) {
45783
45705
  delete _pointerPositions[event.pointerId];
45784
45706
  for (let i = 0; i < _pointers.length; i++) {
45785
- if (_pointers[i].pointerId === event.pointerId) {
45707
+ if (_pointers[i].pointerId == event.pointerId) {
45786
45708
  _pointers.splice(i, 1);
45787
45709
  return;
45788
45710
  }
@@ -45794,7 +45716,7 @@
45794
45716
  position = new Vector2();
45795
45717
  _pointerPositions[event.pointerId] = position;
45796
45718
  }
45797
- position.set(event.clientX, event.clientY);
45719
+ position.set(event.pageX, event.pageY);
45798
45720
  }
45799
45721
  function getSecondPointerPosition(event) {
45800
45722
  const pointer = event.pointerId === _pointers[0].pointerId
@@ -45803,21 +45725,21 @@
45803
45725
  return _pointerPositions[pointer.pointerId];
45804
45726
  }
45805
45727
  this.dispose = function () {
45806
- scope.domElement.removeEventListener("contextmenu", contextmenu, false);
45807
- scope.domElement.removeEventListener("pointerdown", onPointerDown, false);
45808
- scope.domElement.removeEventListener("pointercancel", onPointerCancel, false);
45809
- scope.domElement.removeEventListener("wheel", onMouseWheel, false);
45810
- scope.domElement.removeEventListener("pointermove", onPointerMove, false);
45811
- scope.domElement.removeEventListener("pointerup", onPointerUp, false);
45812
- window.removeEventListener("keydown", keydown, false);
45813
- window.removeEventListener("keyup", keyup, false);
45728
+ scope.domElement.removeEventListener("contextmenu", contextmenu);
45729
+ scope.domElement.removeEventListener("pointerdown", onPointerDown);
45730
+ scope.domElement.removeEventListener("pointercancel", onPointerCancel);
45731
+ scope.domElement.removeEventListener("wheel", onMouseWheel);
45732
+ scope.domElement.removeEventListener("pointermove", onPointerMove);
45733
+ scope.domElement.removeEventListener("pointerup", onPointerUp);
45734
+ window.removeEventListener("keydown", keydown);
45735
+ window.removeEventListener("keyup", keyup);
45814
45736
  };
45815
- this.domElement.addEventListener("contextmenu", contextmenu, false);
45816
- this.domElement.addEventListener("pointerdown", onPointerDown, false);
45817
- this.domElement.addEventListener("pointercancel", onPointerCancel, false);
45737
+ this.domElement.addEventListener("contextmenu", contextmenu);
45738
+ this.domElement.addEventListener("pointerdown", onPointerDown);
45739
+ this.domElement.addEventListener("pointercancel", onPointerCancel);
45818
45740
  this.domElement.addEventListener("wheel", onMouseWheel, { passive: false });
45819
- window.addEventListener("keydown", keydown, false);
45820
- window.addEventListener("keyup", keyup, false);
45741
+ window.addEventListener("keydown", keydown);
45742
+ window.addEventListener("keyup", keyup);
45821
45743
  this.handleResize();
45822
45744
  // force an update at start
45823
45745
  this.update();
@@ -45831,9 +45753,9 @@
45831
45753
  // Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish
45832
45754
  // Pan - right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move
45833
45755
 
45834
- const _changeEvent$2 = { type: 'change' };
45835
- const _startEvent$2 = { type: 'start' };
45836
- const _endEvent$2 = { type: 'end' };
45756
+ const _changeEvent$1 = { type: 'change' };
45757
+ const _startEvent$1 = { type: 'start' };
45758
+ const _endEvent$1 = { type: 'end' };
45837
45759
 
45838
45760
  class OrbitControls extends EventDispatcher {
45839
45761
 
@@ -45962,7 +45884,7 @@
45962
45884
  scope.object.zoom = scope.zoom0;
45963
45885
 
45964
45886
  scope.object.updateProjectionMatrix();
45965
- scope.dispatchEvent( _changeEvent$2 );
45887
+ scope.dispatchEvent( _changeEvent$1 );
45966
45888
 
45967
45889
  scope.update();
45968
45890
 
@@ -46096,7 +46018,7 @@
46096
46018
  lastPosition.distanceToSquared( scope.object.position ) > EPS ||
46097
46019
  8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS ) {
46098
46020
 
46099
- scope.dispatchEvent( _changeEvent$2 );
46021
+ scope.dispatchEvent( _changeEvent$1 );
46100
46022
 
46101
46023
  lastPosition.copy( scope.object.position );
46102
46024
  lastQuaternion.copy( scope.object.quaternion );
@@ -46710,7 +46632,7 @@
46710
46632
 
46711
46633
  }
46712
46634
 
46713
- scope.dispatchEvent( _endEvent$2 );
46635
+ scope.dispatchEvent( _endEvent$1 );
46714
46636
 
46715
46637
  state = STATE.NONE;
46716
46638
 
@@ -46807,7 +46729,7 @@
46807
46729
 
46808
46730
  if ( state !== STATE.NONE ) {
46809
46731
 
46810
- scope.dispatchEvent( _startEvent$2 );
46732
+ scope.dispatchEvent( _startEvent$1 );
46811
46733
 
46812
46734
  }
46813
46735
 
@@ -46851,11 +46773,11 @@
46851
46773
 
46852
46774
  event.preventDefault();
46853
46775
 
46854
- scope.dispatchEvent( _startEvent$2 );
46776
+ scope.dispatchEvent( _startEvent$1 );
46855
46777
 
46856
46778
  handleMouseWheel( event );
46857
46779
 
46858
- scope.dispatchEvent( _endEvent$2 );
46780
+ scope.dispatchEvent( _endEvent$1 );
46859
46781
 
46860
46782
  }
46861
46783
 
@@ -46945,7 +46867,7 @@
46945
46867
 
46946
46868
  if ( state !== STATE.NONE ) {
46947
46869
 
46948
- scope.dispatchEvent( _startEvent$2 );
46870
+ scope.dispatchEvent( _startEvent$1 );
46949
46871
 
46950
46872
  }
46951
46873
 
@@ -48364,543 +48286,6 @@
48364
48286
  }
48365
48287
  }
48366
48288
 
48367
- const _changeEvent$1 = { type: "change" };
48368
- const _startEvent$1 = { type: "start" };
48369
- const _endEvent$1 = { type: "end" };
48370
- class Copper3dTrackballControls1 extends EventDispatcher {
48371
- constructor(object, domElement) {
48372
- super();
48373
- const scope = this;
48374
- const STATE = {
48375
- NONE: -1,
48376
- ROTATE: 0,
48377
- ZOOM: 1,
48378
- PAN: 2,
48379
- TOUCH_ROTATE: 3,
48380
- TOUCH_ZOOM: 4,
48381
- TOUCH_PAN: 5,
48382
- TOUCH_ZOOM_PAN: 6,
48383
- };
48384
- this.object = object;
48385
- this.domElement = domElement;
48386
- this.domElement.style.touchAction = "none"; // disable touch scroll
48387
- // API
48388
- this.enabled = true;
48389
- this.screen = { left: 0, top: 0, width: 0, height: 0 };
48390
- this.rotateSpeed = 1.0;
48391
- this.zoomSpeed = 1.2;
48392
- this.panSpeed = 0.3;
48393
- this.noRotate = false;
48394
- this.noZoom = false;
48395
- this.noPan = false;
48396
- this.staticMoving = false;
48397
- this.dynamicDampingFactor = 0.2;
48398
- this.minDistance = 0;
48399
- this.maxDistance = Infinity;
48400
- this.minZoom = 0;
48401
- this.maxZoom = Infinity;
48402
- this.keys = ["KeyA" /*A*/, "KeyS" /*S*/, "KeyD" /*D*/];
48403
- this.mouseButtons = {
48404
- LEFT: MOUSE.ROTATE,
48405
- MIDDLE: MOUSE.DOLLY,
48406
- RIGHT: MOUSE.PAN,
48407
- };
48408
- // internals
48409
- this.target = new Vector3();
48410
- const EPS = 0.000001;
48411
- const lastPosition = new Vector3();
48412
- let lastZoom = 1;
48413
- let _state = STATE.NONE, _keyState = STATE.NONE, _touchZoomDistanceStart = 0, _touchZoomDistanceEnd = 0, _lastAngle = 0;
48414
- 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 = {};
48415
- // for reset
48416
- this.target0 = this.target.clone();
48417
- this.position0 = this.object.position.clone();
48418
- this.up0 = this.object.up.clone();
48419
- this.zoom0 = this.object.zoom;
48420
- // methods
48421
- this.handleResize = function () {
48422
- const box = scope.domElement.getBoundingClientRect();
48423
- // adjustments come from similar code in the jquery offset() function
48424
- const d = scope.domElement.ownerDocument.documentElement;
48425
- scope.screen.left = box.left + window.pageXOffset - d.clientLeft;
48426
- scope.screen.top = box.top + window.pageYOffset - d.clientTop;
48427
- scope.screen.width = box.width;
48428
- scope.screen.height = box.height;
48429
- };
48430
- const getMouseOnScreen = (function () {
48431
- const vector = new Vector2();
48432
- return function getMouseOnScreen(pageX, pageY) {
48433
- vector.set((pageX - scope.screen.left) / scope.screen.width, (pageY - scope.screen.top) / scope.screen.height);
48434
- return vector;
48435
- };
48436
- })();
48437
- const getMouseOnCircle = (function () {
48438
- const vector = new Vector2();
48439
- return function getMouseOnCircle(pageX, pageY) {
48440
- vector.set((pageX - scope.screen.width * 0.5 - scope.screen.left) /
48441
- (scope.screen.width * 0.5), (scope.screen.height + 2 * (scope.screen.top - pageY)) /
48442
- scope.screen.width // screen.width intentional
48443
- );
48444
- return vector;
48445
- };
48446
- })();
48447
- this.rotateCamera = (function () {
48448
- const axis = new Vector3(), quaternion = new Quaternion(), eyeDirection = new Vector3(), objectUpDirection = new Vector3(), objectSidewaysDirection = new Vector3(), moveDirection = new Vector3();
48449
- return function rotateCamera() {
48450
- moveDirection.set(_moveCurr.x - _movePrev.x, _moveCurr.y - _movePrev.y, 0);
48451
- let angle = moveDirection.length();
48452
- if (angle) {
48453
- _eye.copy(scope.object.position).sub(scope.target);
48454
- eyeDirection.copy(_eye).normalize();
48455
- objectUpDirection.copy(scope.object.up).normalize();
48456
- objectSidewaysDirection
48457
- .crossVectors(objectUpDirection, eyeDirection)
48458
- .normalize();
48459
- objectUpDirection.setLength(_moveCurr.y - _movePrev.y);
48460
- objectSidewaysDirection.setLength(_moveCurr.x - _movePrev.x);
48461
- moveDirection.copy(objectUpDirection.add(objectSidewaysDirection));
48462
- axis.crossVectors(moveDirection, _eye).normalize();
48463
- angle *= scope.rotateSpeed;
48464
- quaternion.setFromAxisAngle(axis, angle);
48465
- _eye.applyQuaternion(quaternion);
48466
- scope.object.up.applyQuaternion(quaternion);
48467
- _lastAxis.copy(axis);
48468
- _lastAngle = angle;
48469
- }
48470
- else if (!scope.staticMoving && _lastAngle) {
48471
- _lastAngle *= Math.sqrt(1.0 - scope.dynamicDampingFactor);
48472
- _eye.copy(scope.object.position).sub(scope.target);
48473
- quaternion.setFromAxisAngle(_lastAxis, _lastAngle);
48474
- _eye.applyQuaternion(quaternion);
48475
- scope.object.up.applyQuaternion(quaternion);
48476
- }
48477
- _movePrev.copy(_moveCurr);
48478
- };
48479
- })();
48480
- this.zoomCamera = function () {
48481
- let factor;
48482
- if (_state === STATE.TOUCH_ZOOM_PAN) {
48483
- factor = _touchZoomDistanceStart / _touchZoomDistanceEnd;
48484
- _touchZoomDistanceStart = _touchZoomDistanceEnd;
48485
- if (scope.object.isPerspectiveCamera) {
48486
- _eye.multiplyScalar(factor);
48487
- }
48488
- else if (scope.object.isOrthographicCamera) {
48489
- scope.object.zoom = MathUtils.clamp(scope.object.zoom / factor, scope.minZoom, scope.maxZoom);
48490
- if (lastZoom !== scope.object.zoom) {
48491
- scope.object.updateProjectionMatrix();
48492
- }
48493
- }
48494
- else {
48495
- console.warn("THREE.TrackballControls: Unsupported camera type");
48496
- }
48497
- }
48498
- else {
48499
- factor = 1.0 + (_zoomEnd.y - _zoomStart.y) * scope.zoomSpeed;
48500
- if (factor !== 1.0 && factor > 0.0) {
48501
- if (scope.object.isPerspectiveCamera) {
48502
- _eye.multiplyScalar(factor);
48503
- }
48504
- else if (scope.object.isOrthographicCamera) {
48505
- scope.object.zoom = MathUtils.clamp(scope.object.zoom / factor, scope.minZoom, scope.maxZoom);
48506
- if (lastZoom !== scope.object.zoom) {
48507
- scope.object.updateProjectionMatrix();
48508
- }
48509
- }
48510
- else {
48511
- console.warn("THREE.TrackballControls: Unsupported camera type");
48512
- }
48513
- }
48514
- if (scope.staticMoving) {
48515
- _zoomStart.copy(_zoomEnd);
48516
- }
48517
- else {
48518
- _zoomStart.y +=
48519
- (_zoomEnd.y - _zoomStart.y) * this.dynamicDampingFactor;
48520
- }
48521
- }
48522
- };
48523
- this.panCamera = (function () {
48524
- const mouseChange = new Vector2(), objectUp = new Vector3(), pan = new Vector3();
48525
- return function panCamera() {
48526
- mouseChange.copy(_panEnd).sub(_panStart);
48527
- if (mouseChange.lengthSq()) {
48528
- if (scope.object.isOrthographicCamera) {
48529
- const scale_x = (scope.object.right -
48530
- scope.object.left) /
48531
- scope.object.zoom /
48532
- scope.domElement.clientWidth;
48533
- const scale_y = (scope.object.top -
48534
- scope.object.bottom) /
48535
- scope.object.zoom /
48536
- scope.domElement.clientWidth;
48537
- mouseChange.x *= scale_x;
48538
- mouseChange.y *= scale_y;
48539
- }
48540
- mouseChange.multiplyScalar(_eye.length() * scope.panSpeed);
48541
- pan.copy(_eye).cross(scope.object.up).setLength(mouseChange.x);
48542
- pan.add(objectUp.copy(scope.object.up).setLength(mouseChange.y));
48543
- scope.object.position.add(pan);
48544
- scope.target.add(pan);
48545
- if (scope.staticMoving) {
48546
- _panStart.copy(_panEnd);
48547
- }
48548
- else {
48549
- _panStart.add(mouseChange
48550
- .subVectors(_panEnd, _panStart)
48551
- .multiplyScalar(scope.dynamicDampingFactor));
48552
- }
48553
- }
48554
- };
48555
- })();
48556
- this.checkDistances = function () {
48557
- if (!scope.noZoom || !scope.noPan) {
48558
- if (_eye.lengthSq() > scope.maxDistance * scope.maxDistance) {
48559
- scope.object.position.addVectors(scope.target, _eye.setLength(scope.maxDistance));
48560
- _zoomStart.copy(_zoomEnd);
48561
- }
48562
- if (_eye.lengthSq() < scope.minDistance * scope.minDistance) {
48563
- scope.object.position.addVectors(scope.target, _eye.setLength(scope.minDistance));
48564
- _zoomStart.copy(_zoomEnd);
48565
- }
48566
- }
48567
- };
48568
- this.update = function () {
48569
- _eye.subVectors(scope.object.position, scope.target);
48570
- if (!scope.noRotate) {
48571
- scope.rotateCamera();
48572
- }
48573
- if (!scope.noZoom) {
48574
- scope.zoomCamera();
48575
- }
48576
- if (!scope.noPan) {
48577
- scope.panCamera();
48578
- }
48579
- scope.object.position.addVectors(scope.target, _eye);
48580
- if (scope.object.isPerspectiveCamera) {
48581
- scope.checkDistances();
48582
- scope.object.lookAt(scope.target);
48583
- if (lastPosition.distanceToSquared(scope.object.position) > EPS) {
48584
- scope.dispatchEvent(_changeEvent$1);
48585
- lastPosition.copy(scope.object.position);
48586
- }
48587
- }
48588
- else if (scope.object.isOrthographicCamera) {
48589
- scope.object.lookAt(scope.target);
48590
- if (lastPosition.distanceToSquared(scope.object.position) > EPS ||
48591
- lastZoom !== scope.object.zoom) {
48592
- scope.dispatchEvent(_changeEvent$1);
48593
- lastPosition.copy(scope.object.position);
48594
- lastZoom = scope.object.zoom;
48595
- }
48596
- }
48597
- else {
48598
- console.warn("THREE.TrackballControls: Unsupported camera type");
48599
- }
48600
- };
48601
- this.reset = function () {
48602
- _state = STATE.NONE;
48603
- _keyState = STATE.NONE;
48604
- scope.target.copy(scope.target0);
48605
- scope.object.position.copy(scope.position0);
48606
- scope.object.up.copy(scope.up0);
48607
- scope.object.zoom = scope.zoom0;
48608
- scope.object.updateProjectionMatrix();
48609
- _eye.subVectors(scope.object.position, scope.target);
48610
- scope.object.lookAt(scope.target);
48611
- scope.dispatchEvent(_changeEvent$1);
48612
- lastPosition.copy(scope.object.position);
48613
- lastZoom = scope.object.zoom;
48614
- };
48615
- // listeners
48616
- function onPointerDown(event) {
48617
- if (scope.enabled === false)
48618
- return;
48619
- if (_pointers.length === 0) {
48620
- scope.domElement.setPointerCapture(event.pointerId);
48621
- scope.domElement.addEventListener("pointermove", onPointerMove);
48622
- scope.domElement.addEventListener("pointerup", onPointerUp);
48623
- }
48624
- //
48625
- addPointer(event);
48626
- if (event.pointerType === "touch") {
48627
- onTouchStart(event);
48628
- }
48629
- else {
48630
- onMouseDown(event);
48631
- }
48632
- }
48633
- function onPointerMove(event) {
48634
- if (scope.enabled === false)
48635
- return;
48636
- if (event.pointerType === "touch") {
48637
- onTouchMove(event);
48638
- }
48639
- else {
48640
- onMouseMove(event);
48641
- }
48642
- }
48643
- function onPointerUp(event) {
48644
- if (scope.enabled === false)
48645
- return;
48646
- if (event.pointerType === "touch") {
48647
- onTouchEnd(event);
48648
- }
48649
- else {
48650
- onMouseUp();
48651
- }
48652
- //
48653
- removePointer(event);
48654
- if (_pointers.length === 0) {
48655
- scope.domElement.releasePointerCapture(event.pointerId);
48656
- scope.domElement.removeEventListener("pointermove", onPointerMove);
48657
- scope.domElement.removeEventListener("pointerup", onPointerUp);
48658
- }
48659
- }
48660
- function onPointerCancel(event) {
48661
- removePointer(event);
48662
- }
48663
- function keydown(event) {
48664
- if (scope.enabled === false)
48665
- return;
48666
- window.removeEventListener("keydown", keydown);
48667
- if (_keyState !== STATE.NONE) {
48668
- return;
48669
- }
48670
- else if (event.code === scope.keys[STATE.ROTATE] && !scope.noRotate) {
48671
- _keyState = STATE.ROTATE;
48672
- }
48673
- else if (event.code === scope.keys[STATE.ZOOM] && !scope.noZoom) {
48674
- _keyState = STATE.ZOOM;
48675
- }
48676
- else if (event.code === scope.keys[STATE.PAN] && !scope.noPan) {
48677
- _keyState = STATE.PAN;
48678
- }
48679
- }
48680
- function keyup() {
48681
- if (scope.enabled === false)
48682
- return;
48683
- _keyState = STATE.NONE;
48684
- window.addEventListener("keydown", keydown);
48685
- }
48686
- function onMouseDown(event) {
48687
- if (_state === STATE.NONE) {
48688
- switch (event.button) {
48689
- case scope.mouseButtons.LEFT:
48690
- _state = STATE.ROTATE;
48691
- break;
48692
- case scope.mouseButtons.MIDDLE:
48693
- _state = STATE.ZOOM;
48694
- break;
48695
- case scope.mouseButtons.RIGHT:
48696
- _state = STATE.PAN;
48697
- break;
48698
- }
48699
- }
48700
- const state = _keyState !== STATE.NONE ? _keyState : _state;
48701
- if (state === STATE.ROTATE && !scope.noRotate) {
48702
- _moveCurr.copy(getMouseOnCircle(event.pageX, event.pageY));
48703
- _movePrev.copy(_moveCurr);
48704
- }
48705
- else if (state === STATE.ZOOM && !scope.noZoom) {
48706
- _zoomStart.copy(getMouseOnScreen(event.pageX, event.pageY));
48707
- _zoomEnd.copy(_zoomStart);
48708
- }
48709
- else if (state === STATE.PAN && !scope.noPan) {
48710
- _panStart.copy(getMouseOnScreen(event.pageX, event.pageY));
48711
- _panEnd.copy(_panStart);
48712
- }
48713
- scope.dispatchEvent(_startEvent$1);
48714
- }
48715
- function onMouseMove(event) {
48716
- const state = _keyState !== STATE.NONE ? _keyState : _state;
48717
- if (state === STATE.ROTATE && !scope.noRotate) {
48718
- _movePrev.copy(_moveCurr);
48719
- _moveCurr.copy(getMouseOnCircle(event.pageX, event.pageY));
48720
- }
48721
- else if (state === STATE.ZOOM && !scope.noZoom) {
48722
- _zoomEnd.copy(getMouseOnScreen(event.pageX, event.pageY));
48723
- }
48724
- else if (state === STATE.PAN && !scope.noPan) {
48725
- _panEnd.copy(getMouseOnScreen(event.pageX, event.pageY));
48726
- }
48727
- }
48728
- function onMouseUp() {
48729
- _state = STATE.NONE;
48730
- scope.dispatchEvent(_endEvent$1);
48731
- }
48732
- function onMouseWheel(event) {
48733
- if (scope.enabled === false)
48734
- return;
48735
- if (scope.noZoom === true)
48736
- return;
48737
- event.preventDefault();
48738
- switch (event.deltaMode) {
48739
- case 2:
48740
- // Zoom in pages
48741
- _zoomStart.y -= event.deltaY * 0.025;
48742
- break;
48743
- case 1:
48744
- // Zoom in lines
48745
- _zoomStart.y -= event.deltaY * 0.01;
48746
- break;
48747
- default:
48748
- // undefined, 0, assume pixels
48749
- _zoomStart.y -= event.deltaY * 0.00025;
48750
- break;
48751
- }
48752
- scope.dispatchEvent(_startEvent$1);
48753
- scope.dispatchEvent(_endEvent$1);
48754
- }
48755
- function onTouchStart(event) {
48756
- trackPointer(event);
48757
- switch (_pointers.length) {
48758
- case 1:
48759
- _state = STATE.TOUCH_ROTATE;
48760
- _moveCurr.copy(getMouseOnCircle(_pointers[0].pageX, _pointers[0].pageY));
48761
- _movePrev.copy(_moveCurr);
48762
- break;
48763
- case 2:
48764
- _state = STATE.TOUCH_ZOOM_PAN;
48765
- const dx = _pointers[0].pageX - _pointers[1].pageX;
48766
- const dy = _pointers[0].pageY - _pointers[1].pageY;
48767
- _touchZoomDistanceEnd = _touchZoomDistanceStart = Math.sqrt(dx * dx + dy * dy);
48768
- const x = (_pointers[0].pageX + _pointers[1].pageX) / 2;
48769
- const y = (_pointers[0].pageY + _pointers[1].pageY) / 2;
48770
- _panStart.copy(getMouseOnScreen(x, y));
48771
- _panEnd.copy(_panStart);
48772
- break;
48773
- case 3:
48774
- _state = STATE.TOUCH_PAN;
48775
- const centerX = (_pointers[0].pageX + _pointers[1].pageX + _pointers[2].pageX) / 3;
48776
- const centerY = (_pointers[0].pageY + _pointers[1].pageY + _pointers[2].pageY) / 3;
48777
- _panStart.copy(getMouseOnScreen(centerX, centerY));
48778
- _panEnd.copy(_panStart);
48779
- break;
48780
- }
48781
- scope.dispatchEvent(_startEvent$1);
48782
- }
48783
- function onTouchMove(event) {
48784
- trackPointer(event);
48785
- let position, x, y;
48786
- switch (_pointers.length) {
48787
- case 1:
48788
- if (_state != STATE.TOUCH_ROTATE)
48789
- return;
48790
- _movePrev.copy(_moveCurr);
48791
- _moveCurr.copy(getMouseOnCircle(event.pageX, event.pageY));
48792
- break;
48793
- case 2:
48794
- if (_state != STATE.TOUCH_ZOOM_PAN)
48795
- return;
48796
- position = getSecondPointerPosition(event);
48797
- const dx = event.pageX - position.x;
48798
- const dy = event.pageY - position.y;
48799
- _touchZoomDistanceEnd = Math.sqrt(dx * dx + dy * dy);
48800
- x = (event.pageX + position.x) / 2;
48801
- y = (event.pageY + position.y) / 2;
48802
- _panEnd.copy(getMouseOnScreen(x, y));
48803
- break;
48804
- case 3:
48805
- if (_state != STATE.TOUCH_PAN)
48806
- return;
48807
- const point_1 = _pointerPositions[_pointers[0].pointerId];
48808
- const point_2 = _pointerPositions[_pointers[1].pointerId];
48809
- const point_3 = _pointerPositions[_pointers[2].pointerId];
48810
- const centerX = (point_1.x + point_2.x + point_3.x) / 3;
48811
- const centerY = (point_1.y + point_2.y + point_3.y) / 3;
48812
- _panEnd.copy(getMouseOnScreen(centerX, centerY));
48813
- break;
48814
- }
48815
- }
48816
- function onTouchEnd(event) {
48817
- switch (_pointers.length) {
48818
- case 0:
48819
- _state = STATE.NONE;
48820
- break;
48821
- case 1:
48822
- _state = STATE.TOUCH_ROTATE;
48823
- _moveCurr.copy(getMouseOnCircle(event.pageX, event.pageY));
48824
- _movePrev.copy(_moveCurr);
48825
- break;
48826
- case 2:
48827
- _state = STATE.TOUCH_ZOOM_PAN;
48828
- for (let i = 0; i < _pointers.length; i++) {
48829
- if (_pointers[i].pointerId !== event.pointerId) {
48830
- const position = _pointerPositions[_pointers[i].pointerId];
48831
- _moveCurr.copy(getMouseOnScreen(position.x, position.y));
48832
- _movePrev.copy(_moveCurr);
48833
- break;
48834
- }
48835
- }
48836
- break;
48837
- case 3:
48838
- _state = STATE.TOUCH_PAN;
48839
- for (let i = 0; i < _pointers.length; i++) {
48840
- if (_pointers[i].pointerId !== event.pointerId) {
48841
- const position = _pointerPositions[_pointers[i].pointerId];
48842
- _moveCurr.copy(getMouseOnScreen(position.x, position.y));
48843
- _movePrev.copy(_moveCurr);
48844
- break;
48845
- }
48846
- }
48847
- break;
48848
- }
48849
- scope.dispatchEvent(_endEvent$1);
48850
- }
48851
- function contextmenu(event) {
48852
- if (scope.enabled === false)
48853
- return;
48854
- event.preventDefault();
48855
- }
48856
- function addPointer(event) {
48857
- _pointers.push(event);
48858
- }
48859
- function removePointer(event) {
48860
- delete _pointerPositions[event.pointerId];
48861
- for (let i = 0; i < _pointers.length; i++) {
48862
- if (_pointers[i].pointerId == event.pointerId) {
48863
- _pointers.splice(i, 1);
48864
- return;
48865
- }
48866
- }
48867
- }
48868
- function trackPointer(event) {
48869
- let position = _pointerPositions[event.pointerId];
48870
- if (position === undefined) {
48871
- position = new Vector2();
48872
- _pointerPositions[event.pointerId] = position;
48873
- }
48874
- position.set(event.pageX, event.pageY);
48875
- }
48876
- function getSecondPointerPosition(event) {
48877
- const pointer = event.pointerId === _pointers[0].pointerId
48878
- ? _pointers[1]
48879
- : _pointers[0];
48880
- return _pointerPositions[pointer.pointerId];
48881
- }
48882
- this.dispose = function () {
48883
- scope.domElement.removeEventListener("contextmenu", contextmenu);
48884
- scope.domElement.removeEventListener("pointerdown", onPointerDown);
48885
- scope.domElement.removeEventListener("pointercancel", onPointerCancel);
48886
- scope.domElement.removeEventListener("wheel", onMouseWheel);
48887
- scope.domElement.removeEventListener("pointermove", onPointerMove);
48888
- scope.domElement.removeEventListener("pointerup", onPointerUp);
48889
- window.removeEventListener("keydown", keydown);
48890
- window.removeEventListener("keyup", keyup);
48891
- };
48892
- this.domElement.addEventListener("contextmenu", contextmenu);
48893
- this.domElement.addEventListener("pointerdown", onPointerDown);
48894
- this.domElement.addEventListener("pointercancel", onPointerCancel);
48895
- this.domElement.addEventListener("wheel", onMouseWheel, { passive: false });
48896
- window.addEventListener("keydown", keydown);
48897
- window.addEventListener("keyup", keyup);
48898
- this.handleResize();
48899
- // force an update at start
48900
- this.update();
48901
- }
48902
- }
48903
-
48904
48289
  /**
48905
48290
  * @param {BufferGeometry} geometry
48906
48291
  * @param {number} drawMode
@@ -56879,7 +56264,7 @@
56879
56264
  this.controls = new OrbitControls(this.camera, this.renderer.domElement);
56880
56265
  }
56881
56266
  else {
56882
- this.controls = new Copper3dTrackballControls1(this.camera, this.renderer.domElement);
56267
+ this.controls = new Copper3dTrackballControls(this.camera, this.renderer.domElement);
56883
56268
  }
56884
56269
  this.controls.panSpeed = 3;
56885
56270
  this.controls.rotateSpeed = 3;
@@ -70382,8 +69767,8 @@
70382
69767
  }
70383
69768
 
70384
69769
  // import * as kiwrious from "copper3d_plugin_heart_k";
70385
- const REVISION = "v1.15.3";
70386
- console.log("%cCopper3D Visualisation %cBeta:v1.15.3", "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25");
69770
+ const REVISION = "v1.15.7";
69771
+ console.log("%cCopper3D Visualisation %cBeta:v1.15.7", "padding: 3px;color:white; background:#023047", "padding: 3px;color:white; background:#f50a25");
70387
69772
 
70388
69773
  exports.CameraViewPoint = CameraViewPoint;
70389
69774
  exports.Copper3dTrackballControls = Copper3dTrackballControls;