vim-web 0.5.0-dev.13 → 0.5.0-dev.14
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
|
@@ -52632,6 +52632,7 @@ class MouseHandler extends BaseInputHandler {
|
|
|
52632
52632
|
__publicField(this, "onClick");
|
|
52633
52633
|
__publicField(this, "onDoubleClick");
|
|
52634
52634
|
__publicField(this, "onWheel");
|
|
52635
|
+
__publicField(this, "onContextMenu");
|
|
52635
52636
|
this._capture = new CaptureHandler(canvas);
|
|
52636
52637
|
this._dragHandler = new DragHandler((delta, button) => this.onDrag(delta, button));
|
|
52637
52638
|
}
|
|
@@ -52673,6 +52674,7 @@ class MouseHandler extends BaseInputHandler {
|
|
|
52673
52674
|
this.handleDoubleClick(event);
|
|
52674
52675
|
} else {
|
|
52675
52676
|
this.handleMouseClick(event);
|
|
52677
|
+
this.handleContextMenu(event);
|
|
52676
52678
|
}
|
|
52677
52679
|
event.preventDefault();
|
|
52678
52680
|
}
|
|
@@ -52687,6 +52689,16 @@ class MouseHandler extends BaseInputHandler {
|
|
|
52687
52689
|
const modif = event.getModifierState("Shift") || event.getModifierState("Control");
|
|
52688
52690
|
(_a3 = this.onClick) == null ? void 0 : _a3.call(this, pos, modif);
|
|
52689
52691
|
}
|
|
52692
|
+
async handleContextMenu(event) {
|
|
52693
|
+
var _a3;
|
|
52694
|
+
if (event.pointerType !== "mouse") return;
|
|
52695
|
+
if (event.button !== 2) return;
|
|
52696
|
+
const pos = this.relativePosition(event);
|
|
52697
|
+
if (!almostEqual(this._lastMouseDownPosition, pos, 0.01)) {
|
|
52698
|
+
return;
|
|
52699
|
+
}
|
|
52700
|
+
(_a3 = this.onContextMenu) == null ? void 0 : _a3.call(this, new Vector2(event.clientX, event.clientY));
|
|
52701
|
+
}
|
|
52690
52702
|
handlePointerMove(event) {
|
|
52691
52703
|
var _a3;
|
|
52692
52704
|
if (event.pointerType !== "mouse") return;
|
|
@@ -52993,10 +53005,6 @@ class InputHandler extends BaseInputHandler {
|
|
|
52993
53005
|
this._moveSpeed = settings2.moveSpeed ?? 1;
|
|
52994
53006
|
this.rotateSpeed = settings2.rotateSpeed ?? 1;
|
|
52995
53007
|
this.orbitSpeed = settings2.orbitSpeed ?? 1;
|
|
52996
|
-
this.reg(document, "contextmenu", (e) => {
|
|
52997
|
-
this._onContextMenu.dispatch(new Vector2(e.clientX, e.clientY));
|
|
52998
|
-
e.preventDefault();
|
|
52999
|
-
});
|
|
53000
53008
|
this.keyboard = new KeyboardHandler(canvas);
|
|
53001
53009
|
this.mouse = new MouseHandler(canvas);
|
|
53002
53010
|
this.touch = new TouchHandler(canvas);
|
|
@@ -53015,18 +53023,28 @@ class InputHandler extends BaseInputHandler {
|
|
|
53015
53023
|
const mul = Math.pow(1.25, this._moveSpeed);
|
|
53016
53024
|
adapter.moveCamera(value.multiplyScalar(mul));
|
|
53017
53025
|
};
|
|
53026
|
+
this.mouse.onContextMenu = (pos) => this._onContextMenu.dispatch(pos);
|
|
53018
53027
|
this.mouse.onButtonDown = adapter.mouseDown;
|
|
53019
53028
|
this.mouse.onMouseMove = adapter.mouseMove;
|
|
53020
|
-
this.mouse.onButtonUp =
|
|
53029
|
+
this.mouse.onButtonUp = (pos, button) => {
|
|
53030
|
+
this.pointerOverride = void 0;
|
|
53031
|
+
adapter.mouseUp(pos, button);
|
|
53032
|
+
};
|
|
53021
53033
|
this.mouse.onDrag = (delta, button) => {
|
|
53022
53034
|
if (button === 0) {
|
|
53023
|
-
if (this.
|
|
53024
|
-
if (this.
|
|
53025
|
-
if (this.
|
|
53026
|
-
if (this.
|
|
53035
|
+
if (this.pointerActive === "orbit") adapter.orbitCamera(toRotation(delta, this.orbitSpeed));
|
|
53036
|
+
if (this.pointerActive === "look") adapter.rotateCamera(toRotation(delta, this.rotateSpeed));
|
|
53037
|
+
if (this.pointerActive === "pan") adapter.panCamera(delta);
|
|
53038
|
+
if (this.pointerActive === "zoom") adapter.dollyCamera(delta);
|
|
53039
|
+
}
|
|
53040
|
+
if (button === 2) {
|
|
53041
|
+
this.pointerOverride = "look";
|
|
53042
|
+
adapter.rotateCamera(toRotation(delta, 1));
|
|
53043
|
+
}
|
|
53044
|
+
if (button === 1) {
|
|
53045
|
+
this.pointerOverride = "pan";
|
|
53046
|
+
adapter.panCamera(delta);
|
|
53027
53047
|
}
|
|
53028
|
-
if (button === 2) adapter.rotateCamera(toRotation(delta, 1));
|
|
53029
|
-
if (button === 1) adapter.panCamera(delta);
|
|
53030
53048
|
};
|
|
53031
53049
|
this.mouse.onClick = (pos, modif) => adapter.selectAtPointer(pos, modif);
|
|
53032
53050
|
this.mouse.onDoubleClick = adapter.frameAtPointer;
|
|
@@ -55904,9 +55922,7 @@ function createAdapter$2(viewer) {
|
|
|
55904
55922
|
viewer.camera.orthographic = !viewer.camera.orthographic;
|
|
55905
55923
|
},
|
|
55906
55924
|
toggleCameraOrbitMode: () => {
|
|
55907
|
-
|
|
55908
|
-
this._pointerFallback = this._pointerActive;
|
|
55909
|
-
this._onPointerModeChanged.dispatch();
|
|
55925
|
+
viewer.inputs.pointerActive = viewer.inputs.pointerActive === PointerMode$1.ORBIT ? PointerMode$1.LOOK : PointerMode$1.ORBIT;
|
|
55910
55926
|
},
|
|
55911
55927
|
resetCamera: () => {
|
|
55912
55928
|
viewer.camera.lerp(0.75).reset();
|