vim-web 0.3.44-dev.82 → 0.3.44-dev.83
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
|
@@ -52455,6 +52455,7 @@ class MouseHandler extends BaseInputHandler {
|
|
|
52455
52455
|
__publicField(this, "_lastMouseDownPosition", new Vector2(0, 0));
|
|
52456
52456
|
__publicField(this, "_capture");
|
|
52457
52457
|
__publicField(this, "_dragHandler");
|
|
52458
|
+
__publicField(this, "_doubleClickHandler", new DoubleClickHandler());
|
|
52458
52459
|
__publicField(this, "onButtonDown");
|
|
52459
52460
|
__publicField(this, "onButtonUp");
|
|
52460
52461
|
__publicField(this, "onMouseMove");
|
|
@@ -52464,29 +52465,29 @@ class MouseHandler extends BaseInputHandler {
|
|
|
52464
52465
|
__publicField(this, "onDoubleClick");
|
|
52465
52466
|
__publicField(this, "onWheel");
|
|
52466
52467
|
this._capture = new CaptureStateMachine(canvas);
|
|
52467
|
-
this._dragHandler = new DragHandler(
|
|
52468
|
+
this._dragHandler = new DragHandler((delta, button) => this.onDrag(delta, button));
|
|
52468
52469
|
}
|
|
52469
52470
|
addListeners() {
|
|
52470
52471
|
this.reg(this._canvas, "pointerdown", (e) => {
|
|
52471
|
-
this.
|
|
52472
|
+
this.handlePointerDown(e);
|
|
52472
52473
|
});
|
|
52473
52474
|
this.reg(this._canvas, "pointerup", (e) => {
|
|
52474
|
-
this.
|
|
52475
|
+
this.handlePointerUp(e);
|
|
52475
52476
|
});
|
|
52476
52477
|
this.reg(this._canvas, "pointermove", (e) => {
|
|
52477
|
-
this.
|
|
52478
|
+
this.handlePointerMove(e);
|
|
52478
52479
|
});
|
|
52479
52480
|
this.reg(this._canvas, "wheel", (e) => {
|
|
52480
52481
|
this.onMouseScroll(e);
|
|
52481
52482
|
});
|
|
52482
52483
|
this.reg(this._canvas, "dblclick", (e) => {
|
|
52483
|
-
this.
|
|
52484
|
+
this.handleDoubleClick(e);
|
|
52484
52485
|
});
|
|
52485
52486
|
}
|
|
52486
52487
|
dispose() {
|
|
52487
52488
|
this.unregister();
|
|
52488
52489
|
}
|
|
52489
|
-
|
|
52490
|
+
handlePointerDown(event) {
|
|
52490
52491
|
var _a3;
|
|
52491
52492
|
if (event.pointerType !== "mouse") return;
|
|
52492
52493
|
const pos = this.relativePosition(event);
|
|
@@ -52496,20 +52497,25 @@ class MouseHandler extends BaseInputHandler {
|
|
|
52496
52497
|
this._capture.onPointerDown(event);
|
|
52497
52498
|
event.preventDefault();
|
|
52498
52499
|
}
|
|
52499
|
-
|
|
52500
|
+
handlePointerUp(event) {
|
|
52500
52501
|
var _a3;
|
|
52501
52502
|
if (event.pointerType !== "mouse") return;
|
|
52502
52503
|
const pos = this.relativePosition(event);
|
|
52503
52504
|
(_a3 = this.onButtonUp) == null ? void 0 : _a3.call(this, pos, event.button);
|
|
52504
|
-
this.handleMouseClick(event);
|
|
52505
52505
|
this._capture.onPointerUp(event);
|
|
52506
52506
|
this._dragHandler.onPointerUp();
|
|
52507
|
+
if (this._doubleClickHandler.checkForDoubleClick(event)) {
|
|
52508
|
+
this.handleDoubleClick(event);
|
|
52509
|
+
} else {
|
|
52510
|
+
this.handleMouseClick(event);
|
|
52511
|
+
}
|
|
52507
52512
|
event.preventDefault();
|
|
52508
52513
|
}
|
|
52509
52514
|
async handleMouseClick(event) {
|
|
52510
52515
|
var _a3;
|
|
52511
52516
|
if (event.pointerType !== "mouse") return;
|
|
52512
52517
|
if (event.button !== 0) return;
|
|
52518
|
+
console.log("click!");
|
|
52513
52519
|
const pos = this.relativePosition(event);
|
|
52514
52520
|
if (!almostEqual(this._lastMouseDownPosition, pos, 0.01)) {
|
|
52515
52521
|
return;
|
|
@@ -52517,7 +52523,7 @@ class MouseHandler extends BaseInputHandler {
|
|
|
52517
52523
|
const modif = event.getModifierState("Shift") || event.getModifierState("Control");
|
|
52518
52524
|
(_a3 = this.onClick) == null ? void 0 : _a3.call(this, pos, modif);
|
|
52519
52525
|
}
|
|
52520
|
-
|
|
52526
|
+
handlePointerMove(event) {
|
|
52521
52527
|
var _a3;
|
|
52522
52528
|
if (event.pointerType !== "mouse") return;
|
|
52523
52529
|
this._canvas.focus();
|
|
@@ -52526,8 +52532,9 @@ class MouseHandler extends BaseInputHandler {
|
|
|
52526
52532
|
this._dragHandler.onPointerMove(pos);
|
|
52527
52533
|
(_a3 = this.onMouseMove) == null ? void 0 : _a3.call(this, pos);
|
|
52528
52534
|
}
|
|
52529
|
-
async
|
|
52535
|
+
async handleDoubleClick(event) {
|
|
52530
52536
|
var _a3;
|
|
52537
|
+
console.log("double click!");
|
|
52531
52538
|
const pos = this.relativePosition(event);
|
|
52532
52539
|
(_a3 = this.onDoubleClick) == null ? void 0 : _a3.call(this, pos);
|
|
52533
52540
|
event.preventDefault();
|
|
@@ -52575,13 +52582,24 @@ class CaptureStateMachine {
|
|
|
52575
52582
|
}
|
|
52576
52583
|
}
|
|
52577
52584
|
}
|
|
52585
|
+
class DoubleClickHandler {
|
|
52586
|
+
constructor() {
|
|
52587
|
+
__publicField(this, "_lastClickTime", 0);
|
|
52588
|
+
__publicField(this, "_clickDelay", 300);
|
|
52589
|
+
}
|
|
52590
|
+
// Delay in milliseconds to consider a double click
|
|
52591
|
+
checkForDoubleClick(event) {
|
|
52592
|
+
const currentTime = Date.now();
|
|
52593
|
+
const timeDiff = currentTime - this._lastClickTime;
|
|
52594
|
+
this._lastClickTime = currentTime;
|
|
52595
|
+
return timeDiff < this._clickDelay;
|
|
52596
|
+
}
|
|
52597
|
+
}
|
|
52578
52598
|
class DragHandler {
|
|
52579
|
-
constructor(
|
|
52580
|
-
__publicField(this, "_canvas");
|
|
52599
|
+
constructor(onDrag) {
|
|
52581
52600
|
__publicField(this, "_lastDragPosition", null);
|
|
52582
52601
|
__publicField(this, "_button");
|
|
52583
52602
|
__publicField(this, "_onDrag");
|
|
52584
|
-
this._canvas = canvas;
|
|
52585
52603
|
this._onDrag = onDrag;
|
|
52586
52604
|
}
|
|
52587
52605
|
/**
|
|
@@ -52611,9 +52629,6 @@ class DragHandler {
|
|
|
52611
52629
|
onPointerUp() {
|
|
52612
52630
|
this._lastDragPosition = null;
|
|
52613
52631
|
}
|
|
52614
|
-
getCanvasSize() {
|
|
52615
|
-
return new Vector2(this._canvas.clientWidth, this._canvas.clientHeight);
|
|
52616
|
-
}
|
|
52617
52632
|
}
|
|
52618
52633
|
class TouchHandler extends BaseInputHandler {
|
|
52619
52634
|
constructor(canvas) {
|
|
@@ -63703,7 +63718,8 @@ function getDefaultSettings() {
|
|
|
63703
63718
|
capacity: {
|
|
63704
63719
|
canFollowUrl: true,
|
|
63705
63720
|
canGoFullScreen: true,
|
|
63706
|
-
canDownload: true
|
|
63721
|
+
canDownload: true,
|
|
63722
|
+
canReadLocalStorage: true
|
|
63707
63723
|
},
|
|
63708
63724
|
ui: {
|
|
63709
63725
|
logo: true,
|