vim-web 0.5.0-dev.23 → 0.5.0-dev.24
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.
package/dist/vim-web.js
CHANGED
|
@@ -52672,6 +52672,7 @@ class MouseHandler extends BaseInputHandler {
|
|
|
52672
52672
|
__publicField(this, "_capture");
|
|
52673
52673
|
__publicField(this, "_dragHandler");
|
|
52674
52674
|
__publicField(this, "_doubleClickHandler", new DoubleClickHandler());
|
|
52675
|
+
__publicField(this, "_clickHandler", new ClickHandler());
|
|
52675
52676
|
__publicField(this, "onButtonDown");
|
|
52676
52677
|
__publicField(this, "onButtonUp");
|
|
52677
52678
|
__publicField(this, "onMouseMove");
|
|
@@ -52708,23 +52709,28 @@ class MouseHandler extends BaseInputHandler {
|
|
|
52708
52709
|
(_a3 = this.onButtonDown) == null ? void 0 : _a3.call(this, pos, event.button);
|
|
52709
52710
|
this._lastMouseDownPosition = pos;
|
|
52710
52711
|
this._dragHandler.onPointerDown(pos, event.button);
|
|
52712
|
+
this._clickHandler.onPointerDown(pos);
|
|
52711
52713
|
this._capture.onPointerDown(event);
|
|
52712
52714
|
event.preventDefault();
|
|
52713
52715
|
}
|
|
52714
52716
|
handlePointerUp(event) {
|
|
52715
52717
|
var _a3;
|
|
52716
52718
|
if (event.pointerType !== "mouse") return;
|
|
52719
|
+
event.preventDefault();
|
|
52717
52720
|
const pos = this.relativePosition(event);
|
|
52718
52721
|
(_a3 = this.onButtonUp) == null ? void 0 : _a3.call(this, pos, event.button);
|
|
52719
52722
|
this._capture.onPointerUp(event);
|
|
52720
52723
|
this._dragHandler.onPointerUp();
|
|
52721
|
-
|
|
52724
|
+
this._clickHandler.onPointerUp();
|
|
52725
|
+
if (this._doubleClickHandler.isDoubleClick(event)) {
|
|
52722
52726
|
this.handleDoubleClick(event);
|
|
52723
|
-
|
|
52727
|
+
return;
|
|
52728
|
+
}
|
|
52729
|
+
if (this._clickHandler.isClick(event)) {
|
|
52724
52730
|
this.handleMouseClick(event);
|
|
52725
|
-
|
|
52731
|
+
return;
|
|
52726
52732
|
}
|
|
52727
|
-
|
|
52733
|
+
this.handleContextMenu(event);
|
|
52728
52734
|
}
|
|
52729
52735
|
async handleMouseClick(event) {
|
|
52730
52736
|
var _a3;
|
|
@@ -52753,6 +52759,7 @@ class MouseHandler extends BaseInputHandler {
|
|
|
52753
52759
|
this._canvas.focus();
|
|
52754
52760
|
const pos = this.relativePosition(event);
|
|
52755
52761
|
this._dragHandler.onPointerMove(pos);
|
|
52762
|
+
this._clickHandler.onPointerMove(pos);
|
|
52756
52763
|
(_a3 = this.onMouseMove) == null ? void 0 : _a3.call(this, pos);
|
|
52757
52764
|
}
|
|
52758
52765
|
async handleDoubleClick(event) {
|
|
@@ -52796,6 +52803,28 @@ class CaptureHandler {
|
|
|
52796
52803
|
}
|
|
52797
52804
|
}
|
|
52798
52805
|
}
|
|
52806
|
+
class ClickHandler {
|
|
52807
|
+
constructor() {
|
|
52808
|
+
__publicField(this, "_moved", false);
|
|
52809
|
+
__publicField(this, "_startPosition", new Vector2());
|
|
52810
|
+
__publicField(this, "_clickThreshold", 3e-3);
|
|
52811
|
+
}
|
|
52812
|
+
onPointerDown(pos) {
|
|
52813
|
+
this._moved = false;
|
|
52814
|
+
this._startPosition.copy(pos);
|
|
52815
|
+
}
|
|
52816
|
+
onPointerMove(pos) {
|
|
52817
|
+
if (pos.distanceTo(this._startPosition) > this._clickThreshold) {
|
|
52818
|
+
this._moved = true;
|
|
52819
|
+
}
|
|
52820
|
+
}
|
|
52821
|
+
onPointerUp() {
|
|
52822
|
+
}
|
|
52823
|
+
isClick(event) {
|
|
52824
|
+
if (event.button !== 0) return false;
|
|
52825
|
+
return !this._moved;
|
|
52826
|
+
}
|
|
52827
|
+
}
|
|
52799
52828
|
class DoubleClickHandler {
|
|
52800
52829
|
constructor() {
|
|
52801
52830
|
__publicField(this, "_lastClickTime", 0);
|
|
@@ -52805,7 +52834,7 @@ class DoubleClickHandler {
|
|
|
52805
52834
|
__publicField(this, "_positionThreshold", 5);
|
|
52806
52835
|
}
|
|
52807
52836
|
// Max pixel distance between clicks
|
|
52808
|
-
|
|
52837
|
+
isDoubleClick(event) {
|
|
52809
52838
|
const currentTime = Date.now();
|
|
52810
52839
|
const currentPosition = new Vector2(event.clientX, event.clientY);
|
|
52811
52840
|
const timeDiff = currentTime - this._lastClickTime;
|