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.
|
@@ -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,29 @@ 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
52499
|
this.reg(this._canvas, "dblclick", (e) => {
|
|
52499
|
-
this.
|
|
52500
|
+
this.handleDoubleClick(e);
|
|
52500
52501
|
});
|
|
52501
52502
|
}
|
|
52502
52503
|
dispose() {
|
|
52503
52504
|
this.unregister();
|
|
52504
52505
|
}
|
|
52505
|
-
|
|
52506
|
+
handlePointerDown(event) {
|
|
52506
52507
|
var _a3;
|
|
52507
52508
|
if (event.pointerType !== "mouse") return;
|
|
52508
52509
|
const pos = this.relativePosition(event);
|
|
@@ -52512,20 +52513,25 @@ void main() {
|
|
|
52512
52513
|
this._capture.onPointerDown(event);
|
|
52513
52514
|
event.preventDefault();
|
|
52514
52515
|
}
|
|
52515
|
-
|
|
52516
|
+
handlePointerUp(event) {
|
|
52516
52517
|
var _a3;
|
|
52517
52518
|
if (event.pointerType !== "mouse") return;
|
|
52518
52519
|
const pos = this.relativePosition(event);
|
|
52519
52520
|
(_a3 = this.onButtonUp) == null ? void 0 : _a3.call(this, pos, event.button);
|
|
52520
|
-
this.handleMouseClick(event);
|
|
52521
52521
|
this._capture.onPointerUp(event);
|
|
52522
52522
|
this._dragHandler.onPointerUp();
|
|
52523
|
+
if (this._doubleClickHandler.checkForDoubleClick(event)) {
|
|
52524
|
+
this.handleDoubleClick(event);
|
|
52525
|
+
} else {
|
|
52526
|
+
this.handleMouseClick(event);
|
|
52527
|
+
}
|
|
52523
52528
|
event.preventDefault();
|
|
52524
52529
|
}
|
|
52525
52530
|
async handleMouseClick(event) {
|
|
52526
52531
|
var _a3;
|
|
52527
52532
|
if (event.pointerType !== "mouse") return;
|
|
52528
52533
|
if (event.button !== 0) return;
|
|
52534
|
+
console.log("click!");
|
|
52529
52535
|
const pos = this.relativePosition(event);
|
|
52530
52536
|
if (!almostEqual(this._lastMouseDownPosition, pos, 0.01)) {
|
|
52531
52537
|
return;
|
|
@@ -52533,7 +52539,7 @@ void main() {
|
|
|
52533
52539
|
const modif = event.getModifierState("Shift") || event.getModifierState("Control");
|
|
52534
52540
|
(_a3 = this.onClick) == null ? void 0 : _a3.call(this, pos, modif);
|
|
52535
52541
|
}
|
|
52536
|
-
|
|
52542
|
+
handlePointerMove(event) {
|
|
52537
52543
|
var _a3;
|
|
52538
52544
|
if (event.pointerType !== "mouse") return;
|
|
52539
52545
|
this._canvas.focus();
|
|
@@ -52542,8 +52548,9 @@ void main() {
|
|
|
52542
52548
|
this._dragHandler.onPointerMove(pos);
|
|
52543
52549
|
(_a3 = this.onMouseMove) == null ? void 0 : _a3.call(this, pos);
|
|
52544
52550
|
}
|
|
52545
|
-
async
|
|
52551
|
+
async handleDoubleClick(event) {
|
|
52546
52552
|
var _a3;
|
|
52553
|
+
console.log("double click!");
|
|
52547
52554
|
const pos = this.relativePosition(event);
|
|
52548
52555
|
(_a3 = this.onDoubleClick) == null ? void 0 : _a3.call(this, pos);
|
|
52549
52556
|
event.preventDefault();
|
|
@@ -52591,13 +52598,24 @@ void main() {
|
|
|
52591
52598
|
}
|
|
52592
52599
|
}
|
|
52593
52600
|
}
|
|
52601
|
+
class DoubleClickHandler {
|
|
52602
|
+
constructor() {
|
|
52603
|
+
__publicField(this, "_lastClickTime", 0);
|
|
52604
|
+
__publicField(this, "_clickDelay", 300);
|
|
52605
|
+
}
|
|
52606
|
+
// Delay in milliseconds to consider a double click
|
|
52607
|
+
checkForDoubleClick(event) {
|
|
52608
|
+
const currentTime = Date.now();
|
|
52609
|
+
const timeDiff = currentTime - this._lastClickTime;
|
|
52610
|
+
this._lastClickTime = currentTime;
|
|
52611
|
+
return timeDiff < this._clickDelay;
|
|
52612
|
+
}
|
|
52613
|
+
}
|
|
52594
52614
|
class DragHandler {
|
|
52595
|
-
constructor(
|
|
52596
|
-
__publicField(this, "_canvas");
|
|
52615
|
+
constructor(onDrag) {
|
|
52597
52616
|
__publicField(this, "_lastDragPosition", null);
|
|
52598
52617
|
__publicField(this, "_button");
|
|
52599
52618
|
__publicField(this, "_onDrag");
|
|
52600
|
-
this._canvas = canvas;
|
|
52601
52619
|
this._onDrag = onDrag;
|
|
52602
52620
|
}
|
|
52603
52621
|
/**
|
|
@@ -52627,9 +52645,6 @@ void main() {
|
|
|
52627
52645
|
onPointerUp() {
|
|
52628
52646
|
this._lastDragPosition = null;
|
|
52629
52647
|
}
|
|
52630
|
-
getCanvasSize() {
|
|
52631
|
-
return new Vector2(this._canvas.clientWidth, this._canvas.clientHeight);
|
|
52632
|
-
}
|
|
52633
52648
|
}
|
|
52634
52649
|
class TouchHandler extends BaseInputHandler {
|
|
52635
52650
|
constructor(canvas) {
|
|
@@ -63719,7 +63734,8 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
63719
63734
|
capacity: {
|
|
63720
63735
|
canFollowUrl: true,
|
|
63721
63736
|
canGoFullScreen: true,
|
|
63722
|
-
canDownload: true
|
|
63737
|
+
canDownload: true,
|
|
63738
|
+
canReadLocalStorage: true
|
|
63723
63739
|
},
|
|
63724
63740
|
ui: {
|
|
63725
63741
|
logo: true,
|