vim-web 0.3.44-dev.82 → 0.3.44-dev.84
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.
|
@@ -5,6 +5,7 @@ export declare class MouseHandler extends BaseInputHandler {
|
|
|
5
5
|
private _lastMouseDownPosition;
|
|
6
6
|
private _capture;
|
|
7
7
|
private _dragHandler;
|
|
8
|
+
private _doubleClickHandler;
|
|
8
9
|
onButtonDown: (pos: THREE.Vector2, button: number) => void;
|
|
9
10
|
onButtonUp: (pos: THREE.Vector2, button: number) => void;
|
|
10
11
|
onMouseMove: (event: THREE.Vector2) => void;
|
|
@@ -15,11 +16,11 @@ export declare class MouseHandler extends BaseInputHandler {
|
|
|
15
16
|
constructor(canvas: HTMLCanvasElement);
|
|
16
17
|
protected addListeners(): void;
|
|
17
18
|
dispose(): void;
|
|
18
|
-
private
|
|
19
|
-
private
|
|
19
|
+
private handlePointerDown;
|
|
20
|
+
private handlePointerUp;
|
|
20
21
|
private handleMouseClick;
|
|
21
|
-
private
|
|
22
|
-
private
|
|
22
|
+
private handlePointerMove;
|
|
23
|
+
private handleDoubleClick;
|
|
23
24
|
private onMouseScroll;
|
|
24
25
|
private relativePosition;
|
|
25
26
|
}
|
package/dist/vim-web.iife.js
CHANGED
|
@@ -52471,6 +52471,7 @@ void main() {
|
|
|
52471
52471
|
__publicField(this, "_lastMouseDownPosition", new Vector2(0, 0));
|
|
52472
52472
|
__publicField(this, "_capture");
|
|
52473
52473
|
__publicField(this, "_dragHandler");
|
|
52474
|
+
__publicField(this, "_doubleClickHandler", new DoubleClickHandler());
|
|
52474
52475
|
__publicField(this, "onButtonDown");
|
|
52475
52476
|
__publicField(this, "onButtonUp");
|
|
52476
52477
|
__publicField(this, "onMouseMove");
|
|
@@ -52480,29 +52481,26 @@ void main() {
|
|
|
52480
52481
|
__publicField(this, "onDoubleClick");
|
|
52481
52482
|
__publicField(this, "onWheel");
|
|
52482
52483
|
this._capture = new CaptureStateMachine(canvas);
|
|
52483
|
-
this._dragHandler = new DragHandler(
|
|
52484
|
+
this._dragHandler = new DragHandler((delta, button) => this.onDrag(delta, button));
|
|
52484
52485
|
}
|
|
52485
52486
|
addListeners() {
|
|
52486
52487
|
this.reg(this._canvas, "pointerdown", (e) => {
|
|
52487
|
-
this.
|
|
52488
|
+
this.handlePointerDown(e);
|
|
52488
52489
|
});
|
|
52489
52490
|
this.reg(this._canvas, "pointerup", (e) => {
|
|
52490
|
-
this.
|
|
52491
|
+
this.handlePointerUp(e);
|
|
52491
52492
|
});
|
|
52492
52493
|
this.reg(this._canvas, "pointermove", (e) => {
|
|
52493
|
-
this.
|
|
52494
|
+
this.handlePointerMove(e);
|
|
52494
52495
|
});
|
|
52495
52496
|
this.reg(this._canvas, "wheel", (e) => {
|
|
52496
52497
|
this.onMouseScroll(e);
|
|
52497
52498
|
});
|
|
52498
|
-
this.reg(this._canvas, "dblclick", (e) => {
|
|
52499
|
-
this._onDoubleClick(e);
|
|
52500
|
-
});
|
|
52501
52499
|
}
|
|
52502
52500
|
dispose() {
|
|
52503
52501
|
this.unregister();
|
|
52504
52502
|
}
|
|
52505
|
-
|
|
52503
|
+
handlePointerDown(event) {
|
|
52506
52504
|
var _a3;
|
|
52507
52505
|
if (event.pointerType !== "mouse") return;
|
|
52508
52506
|
const pos = this.relativePosition(event);
|
|
@@ -52512,14 +52510,18 @@ void main() {
|
|
|
52512
52510
|
this._capture.onPointerDown(event);
|
|
52513
52511
|
event.preventDefault();
|
|
52514
52512
|
}
|
|
52515
|
-
|
|
52513
|
+
handlePointerUp(event) {
|
|
52516
52514
|
var _a3;
|
|
52517
52515
|
if (event.pointerType !== "mouse") return;
|
|
52518
52516
|
const pos = this.relativePosition(event);
|
|
52519
52517
|
(_a3 = this.onButtonUp) == null ? void 0 : _a3.call(this, pos, event.button);
|
|
52520
|
-
this.handleMouseClick(event);
|
|
52521
52518
|
this._capture.onPointerUp(event);
|
|
52522
52519
|
this._dragHandler.onPointerUp();
|
|
52520
|
+
if (this._doubleClickHandler.checkForDoubleClick(event)) {
|
|
52521
|
+
this.handleDoubleClick(event);
|
|
52522
|
+
} else {
|
|
52523
|
+
this.handleMouseClick(event);
|
|
52524
|
+
}
|
|
52523
52525
|
event.preventDefault();
|
|
52524
52526
|
}
|
|
52525
52527
|
async handleMouseClick(event) {
|
|
@@ -52533,7 +52535,7 @@ void main() {
|
|
|
52533
52535
|
const modif = event.getModifierState("Shift") || event.getModifierState("Control");
|
|
52534
52536
|
(_a3 = this.onClick) == null ? void 0 : _a3.call(this, pos, modif);
|
|
52535
52537
|
}
|
|
52536
|
-
|
|
52538
|
+
handlePointerMove(event) {
|
|
52537
52539
|
var _a3;
|
|
52538
52540
|
if (event.pointerType !== "mouse") return;
|
|
52539
52541
|
this._canvas.focus();
|
|
@@ -52542,7 +52544,7 @@ void main() {
|
|
|
52542
52544
|
this._dragHandler.onPointerMove(pos);
|
|
52543
52545
|
(_a3 = this.onMouseMove) == null ? void 0 : _a3.call(this, pos);
|
|
52544
52546
|
}
|
|
52545
|
-
async
|
|
52547
|
+
async handleDoubleClick(event) {
|
|
52546
52548
|
var _a3;
|
|
52547
52549
|
const pos = this.relativePosition(event);
|
|
52548
52550
|
(_a3 = this.onDoubleClick) == null ? void 0 : _a3.call(this, pos);
|
|
@@ -52591,13 +52593,24 @@ void main() {
|
|
|
52591
52593
|
}
|
|
52592
52594
|
}
|
|
52593
52595
|
}
|
|
52596
|
+
class DoubleClickHandler {
|
|
52597
|
+
constructor() {
|
|
52598
|
+
__publicField(this, "_lastClickTime", 0);
|
|
52599
|
+
__publicField(this, "_clickDelay", 300);
|
|
52600
|
+
}
|
|
52601
|
+
// Delay in milliseconds to consider a double click
|
|
52602
|
+
checkForDoubleClick(event) {
|
|
52603
|
+
const currentTime = Date.now();
|
|
52604
|
+
const timeDiff = currentTime - this._lastClickTime;
|
|
52605
|
+
this._lastClickTime = currentTime;
|
|
52606
|
+
return timeDiff < this._clickDelay;
|
|
52607
|
+
}
|
|
52608
|
+
}
|
|
52594
52609
|
class DragHandler {
|
|
52595
|
-
constructor(
|
|
52596
|
-
__publicField(this, "_canvas");
|
|
52610
|
+
constructor(onDrag) {
|
|
52597
52611
|
__publicField(this, "_lastDragPosition", null);
|
|
52598
52612
|
__publicField(this, "_button");
|
|
52599
52613
|
__publicField(this, "_onDrag");
|
|
52600
|
-
this._canvas = canvas;
|
|
52601
52614
|
this._onDrag = onDrag;
|
|
52602
52615
|
}
|
|
52603
52616
|
/**
|
|
@@ -52627,9 +52640,6 @@ void main() {
|
|
|
52627
52640
|
onPointerUp() {
|
|
52628
52641
|
this._lastDragPosition = null;
|
|
52629
52642
|
}
|
|
52630
|
-
getCanvasSize() {
|
|
52631
|
-
return new Vector2(this._canvas.clientWidth, this._canvas.clientHeight);
|
|
52632
|
-
}
|
|
52633
52643
|
}
|
|
52634
52644
|
class TouchHandler extends BaseInputHandler {
|
|
52635
52645
|
constructor(canvas) {
|
|
@@ -63719,7 +63729,8 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
63719
63729
|
capacity: {
|
|
63720
63730
|
canFollowUrl: true,
|
|
63721
63731
|
canGoFullScreen: true,
|
|
63722
|
-
canDownload: true
|
|
63732
|
+
canDownload: true,
|
|
63733
|
+
canReadLocalStorage: true
|
|
63723
63734
|
},
|
|
63724
63735
|
ui: {
|
|
63725
63736
|
logo: true,
|