vim-web 0.5.0-dev.23 → 0.5.0-dev.25

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.
@@ -6,6 +6,7 @@ export declare class MouseHandler extends BaseInputHandler {
6
6
  private _capture;
7
7
  private _dragHandler;
8
8
  private _doubleClickHandler;
9
+ private _clickHandler;
9
10
  onButtonDown: (pos: THREE.Vector2, button: number) => void;
10
11
  onButtonUp: (pos: THREE.Vector2, button: number) => void;
11
12
  onMouseMove: (event: THREE.Vector2) => void;
@@ -52688,6 +52688,7 @@ void main() {
52688
52688
  __publicField(this, "_capture");
52689
52689
  __publicField(this, "_dragHandler");
52690
52690
  __publicField(this, "_doubleClickHandler", new DoubleClickHandler());
52691
+ __publicField(this, "_clickHandler", new ClickHandler());
52691
52692
  __publicField(this, "onButtonDown");
52692
52693
  __publicField(this, "onButtonUp");
52693
52694
  __publicField(this, "onMouseMove");
@@ -52724,23 +52725,28 @@ void main() {
52724
52725
  (_a3 = this.onButtonDown) == null ? void 0 : _a3.call(this, pos, event.button);
52725
52726
  this._lastMouseDownPosition = pos;
52726
52727
  this._dragHandler.onPointerDown(pos, event.button);
52728
+ this._clickHandler.onPointerDown(pos);
52727
52729
  this._capture.onPointerDown(event);
52728
52730
  event.preventDefault();
52729
52731
  }
52730
52732
  handlePointerUp(event) {
52731
52733
  var _a3;
52732
52734
  if (event.pointerType !== "mouse") return;
52735
+ event.preventDefault();
52733
52736
  const pos = this.relativePosition(event);
52734
52737
  (_a3 = this.onButtonUp) == null ? void 0 : _a3.call(this, pos, event.button);
52735
52738
  this._capture.onPointerUp(event);
52736
52739
  this._dragHandler.onPointerUp();
52737
- if (this._doubleClickHandler.checkForDoubleClick(event)) {
52740
+ this._clickHandler.onPointerUp();
52741
+ if (this._doubleClickHandler.isDoubleClick(event)) {
52738
52742
  this.handleDoubleClick(event);
52739
- } else {
52743
+ return;
52744
+ }
52745
+ if (this._clickHandler.isClick(event)) {
52740
52746
  this.handleMouseClick(event);
52741
- this.handleContextMenu(event);
52747
+ return;
52742
52748
  }
52743
- event.preventDefault();
52749
+ this.handleContextMenu(event);
52744
52750
  }
52745
52751
  async handleMouseClick(event) {
52746
52752
  var _a3;
@@ -52769,6 +52775,7 @@ void main() {
52769
52775
  this._canvas.focus();
52770
52776
  const pos = this.relativePosition(event);
52771
52777
  this._dragHandler.onPointerMove(pos);
52778
+ this._clickHandler.onPointerMove(pos);
52772
52779
  (_a3 = this.onMouseMove) == null ? void 0 : _a3.call(this, pos);
52773
52780
  }
52774
52781
  async handleDoubleClick(event) {
@@ -52812,6 +52819,28 @@ void main() {
52812
52819
  }
52813
52820
  }
52814
52821
  }
52822
+ class ClickHandler {
52823
+ constructor() {
52824
+ __publicField(this, "_moved", false);
52825
+ __publicField(this, "_startPosition", new Vector2());
52826
+ __publicField(this, "_clickThreshold", 3e-3);
52827
+ }
52828
+ onPointerDown(pos) {
52829
+ this._moved = false;
52830
+ this._startPosition.copy(pos);
52831
+ }
52832
+ onPointerMove(pos) {
52833
+ if (pos.distanceTo(this._startPosition) > this._clickThreshold) {
52834
+ this._moved = true;
52835
+ }
52836
+ }
52837
+ onPointerUp() {
52838
+ }
52839
+ isClick(event) {
52840
+ if (event.button !== 0) return false;
52841
+ return !this._moved;
52842
+ }
52843
+ }
52815
52844
  class DoubleClickHandler {
52816
52845
  constructor() {
52817
52846
  __publicField(this, "_lastClickTime", 0);
@@ -52821,7 +52850,7 @@ void main() {
52821
52850
  __publicField(this, "_positionThreshold", 5);
52822
52851
  }
52823
52852
  // Max pixel distance between clicks
52824
- checkForDoubleClick(event) {
52853
+ isDoubleClick(event) {
52825
52854
  const currentTime = Date.now();
52826
52855
  const currentPosition = new Vector2(event.clientX, event.clientY);
52827
52856
  const timeDiff = currentTime - this._lastClickTime;
@@ -74900,7 +74929,10 @@ Averrage Date/Second ${avgDataRatePS} kb
74900
74929
  mainText(/* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: "We encountered an error connecting to VIM Ultra." })),
74901
74930
  subTitle("Tips"),
74902
74931
  numList([
74903
- `Ensure that VIM Ultra is running at ${detailText(url)}`,
74932
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
74933
+ "Ensure that VIM Ultra is running at ",
74934
+ detailText(url)
74935
+ ] }),
74904
74936
  "Check your network connection and access policies"
74905
74937
  ])
74906
74938
  ] });