@ue-too/board 0.17.4 → 0.17.6

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.
@@ -450,6 +450,32 @@ export default class Board {
450
450
  set clampRotation(value: boolean);
451
451
  getCameraRig(): CameraRig;
452
452
  setInputMode(mode: 'kmt' | 'trackpad'): void;
453
+ /**
454
+ * The current input modality.
455
+ *
456
+ * @returns `'kmt'` (keyboard-mouse), `'trackpad'`, or `'TBD'` when
457
+ * auto-detection is active and has not yet committed to a mode.
458
+ */
459
+ get inputMode(): 'kmt' | 'trackpad' | 'TBD';
460
+ /**
461
+ * Flips the input mode between keyboard-mouse and trackpad and locks it,
462
+ * disabling auto-detection.
463
+ *
464
+ * From `'kmt'` this switches to `'trackpad'`; from `'trackpad'` or `'TBD'`
465
+ * it switches to `'kmt'`. (`'TBD'` already behaves like trackpad, so the
466
+ * natural "other" mode to toggle into is `'kmt'`.)
467
+ *
468
+ * @see {@link setInputMode} to set a specific mode, and
469
+ * {@link enableAutoInputMode} to return to auto-detection.
470
+ */
471
+ toggleInputMode(): void;
472
+ /**
473
+ * Returns the board to auto-detection of input modality after a manual lock
474
+ * set via {@link setInputMode} or {@link toggleInputMode}.
475
+ *
476
+ * The mode reverts to `'TBD'` until auto-detection commits to a mode.
477
+ */
478
+ enableAutoInputMode(): void;
453
479
  onCanvasDimensionChange(callback: (dimensions: CanvasDimensions) => void): () => void;
454
480
  get canvasDimensions(): CanvasDimensions;
455
481
  }
package/index.js CHANGED
@@ -3517,18 +3517,6 @@ class CanvasProxy {
3517
3517
  this._canvas = canvas;
3518
3518
  this._canvasPositionDimensionPublisher.attach(canvas);
3519
3519
  }
3520
- logCanvasTrueSize() {
3521
- if (this._canvas === undefined) {
3522
- return;
3523
- }
3524
- console.log("canvas true size");
3525
- console.log("style width", this._canvas.style.width);
3526
- console.log("style height", this._canvas.style.height);
3527
- console.log("width", this._canvas.width);
3528
- console.log("height", this._canvas.height);
3529
- console.log("proxy width", this._width);
3530
- console.log("proxy height", this._height);
3531
- }
3532
3520
  }
3533
3521
 
3534
3522
  class SvgProxy {
@@ -3627,18 +3615,6 @@ class SvgProxy {
3627
3615
  position: this._position
3628
3616
  });
3629
3617
  }
3630
- logCanvasTrueSize() {
3631
- if (this._svg === undefined) {
3632
- return;
3633
- }
3634
- console.log("canvas true size");
3635
- console.log("style width", this._svg.style.width);
3636
- console.log("style height", this._svg.style.height);
3637
- console.log("width", this._svg.width);
3638
- console.log("height", this._svg.height);
3639
- console.log("proxy width", this._width);
3640
- console.log("proxy height", this._height);
3641
- }
3642
3618
  }
3643
3619
 
3644
3620
  class WorkerRelayCanvas {
@@ -3749,6 +3725,7 @@ class ObservableInputTracker {
3749
3725
  enableInputModeDetection() {
3750
3726
  this._deciding = true;
3751
3727
  this._kmtTrackpadTrackScore = 0;
3728
+ this._mode = "TBD";
3752
3729
  }
3753
3730
  get kmtTrackpadTrackScore() {
3754
3731
  return this._kmtTrackpadTrackScore;
@@ -4461,7 +4438,6 @@ class VanillaKMTEventParser {
4461
4438
  }
4462
4439
  }
4463
4440
  keypressHandler(e) {
4464
- console.log("keypressHandler", e.key);
4465
4441
  if (e.target !== document.body) {
4466
4442
  return;
4467
4443
  }
@@ -4473,7 +4449,6 @@ class VanillaKMTEventParser {
4473
4449
  this.processEvent("spacebarDown");
4474
4450
  }
4475
4451
  if (e.key === "Escape") {
4476
- console.log("escape key pressed");
4477
4452
  this.processEvent("escapeKey");
4478
4453
  }
4479
4454
  if (e.key === "ArrowUp") {
@@ -4804,7 +4779,6 @@ class Board {
4804
4779
  this._kmtParser = new VanillaKMTEventParser(kmtInputStateMachine, this._inputOrchestrator, canvas);
4805
4780
  this._touchParser = new VanillaTouchEventParser(touchInputStateMachine, this._inputOrchestrator, canvas);
4806
4781
  if (canvas != null) {
4807
- console.log("canvas exists on creation of board");
4808
4782
  this.attach(canvas, debug);
4809
4783
  }
4810
4784
  }
@@ -5088,6 +5062,15 @@ class Board {
5088
5062
  setInputMode(mode) {
5089
5063
  this._observableInputTracker.setMode(mode);
5090
5064
  }
5065
+ get inputMode() {
5066
+ return this._observableInputTracker.mode;
5067
+ }
5068
+ toggleInputMode() {
5069
+ this.setInputMode(this.inputMode === "kmt" ? "trackpad" : "kmt");
5070
+ }
5071
+ enableAutoInputMode() {
5072
+ this._observableInputTracker.enableInputModeDetection();
5073
+ }
5091
5074
  onCanvasDimensionChange(callback) {
5092
5075
  return this._canvasProxy.subscribe(callback);
5093
5076
  }
@@ -5259,6 +5242,6 @@ export {
5259
5242
  AcceptingUserInputState
5260
5243
  };
5261
5244
 
5262
- //# debugId=1FDA39FB516201FF64756E2164756E21
5245
+ //# debugId=A2D65F1C764E7BEC64756E2164756E21
5263
5246
 
5264
5247
  //# sourceMappingURL=index.js.map