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.
|
@@ -13,12 +13,14 @@ export declare class MouseHandler extends BaseInputHandler {
|
|
|
13
13
|
onClick: (position: THREE.Vector2, ctrl: boolean) => void;
|
|
14
14
|
onDoubleClick: (position: THREE.Vector2) => void;
|
|
15
15
|
onWheel: (value: number, ctrl: boolean) => void;
|
|
16
|
+
onContextMenu: (position: THREE.Vector2) => void;
|
|
16
17
|
constructor(canvas: HTMLCanvasElement);
|
|
17
18
|
protected addListeners(): void;
|
|
18
19
|
dispose(): void;
|
|
19
20
|
private handlePointerDown;
|
|
20
21
|
private handlePointerUp;
|
|
21
22
|
private handleMouseClick;
|
|
23
|
+
private handleContextMenu;
|
|
22
24
|
private handlePointerMove;
|
|
23
25
|
private handleDoubleClick;
|
|
24
26
|
private onMouseScroll;
|
package/dist/vim-web.iife.js
CHANGED
|
@@ -52648,6 +52648,7 @@ void main() {
|
|
|
52648
52648
|
__publicField(this, "onClick");
|
|
52649
52649
|
__publicField(this, "onDoubleClick");
|
|
52650
52650
|
__publicField(this, "onWheel");
|
|
52651
|
+
__publicField(this, "onContextMenu");
|
|
52651
52652
|
this._capture = new CaptureHandler(canvas);
|
|
52652
52653
|
this._dragHandler = new DragHandler((delta, button) => this.onDrag(delta, button));
|
|
52653
52654
|
}
|
|
@@ -52689,6 +52690,7 @@ void main() {
|
|
|
52689
52690
|
this.handleDoubleClick(event);
|
|
52690
52691
|
} else {
|
|
52691
52692
|
this.handleMouseClick(event);
|
|
52693
|
+
this.handleContextMenu(event);
|
|
52692
52694
|
}
|
|
52693
52695
|
event.preventDefault();
|
|
52694
52696
|
}
|
|
@@ -52703,6 +52705,16 @@ void main() {
|
|
|
52703
52705
|
const modif = event.getModifierState("Shift") || event.getModifierState("Control");
|
|
52704
52706
|
(_a3 = this.onClick) == null ? void 0 : _a3.call(this, pos, modif);
|
|
52705
52707
|
}
|
|
52708
|
+
async handleContextMenu(event) {
|
|
52709
|
+
var _a3;
|
|
52710
|
+
if (event.pointerType !== "mouse") return;
|
|
52711
|
+
if (event.button !== 2) return;
|
|
52712
|
+
const pos = this.relativePosition(event);
|
|
52713
|
+
if (!almostEqual(this._lastMouseDownPosition, pos, 0.01)) {
|
|
52714
|
+
return;
|
|
52715
|
+
}
|
|
52716
|
+
(_a3 = this.onContextMenu) == null ? void 0 : _a3.call(this, new Vector2(event.clientX, event.clientY));
|
|
52717
|
+
}
|
|
52706
52718
|
handlePointerMove(event) {
|
|
52707
52719
|
var _a3;
|
|
52708
52720
|
if (event.pointerType !== "mouse") return;
|
|
@@ -53009,10 +53021,6 @@ void main() {
|
|
|
53009
53021
|
this._moveSpeed = settings2.moveSpeed ?? 1;
|
|
53010
53022
|
this.rotateSpeed = settings2.rotateSpeed ?? 1;
|
|
53011
53023
|
this.orbitSpeed = settings2.orbitSpeed ?? 1;
|
|
53012
|
-
this.reg(document, "contextmenu", (e) => {
|
|
53013
|
-
this._onContextMenu.dispatch(new Vector2(e.clientX, e.clientY));
|
|
53014
|
-
e.preventDefault();
|
|
53015
|
-
});
|
|
53016
53024
|
this.keyboard = new KeyboardHandler(canvas);
|
|
53017
53025
|
this.mouse = new MouseHandler(canvas);
|
|
53018
53026
|
this.touch = new TouchHandler(canvas);
|
|
@@ -53031,18 +53039,28 @@ void main() {
|
|
|
53031
53039
|
const mul = Math.pow(1.25, this._moveSpeed);
|
|
53032
53040
|
adapter.moveCamera(value.multiplyScalar(mul));
|
|
53033
53041
|
};
|
|
53042
|
+
this.mouse.onContextMenu = (pos) => this._onContextMenu.dispatch(pos);
|
|
53034
53043
|
this.mouse.onButtonDown = adapter.mouseDown;
|
|
53035
53044
|
this.mouse.onMouseMove = adapter.mouseMove;
|
|
53036
|
-
this.mouse.onButtonUp =
|
|
53045
|
+
this.mouse.onButtonUp = (pos, button) => {
|
|
53046
|
+
this.pointerOverride = void 0;
|
|
53047
|
+
adapter.mouseUp(pos, button);
|
|
53048
|
+
};
|
|
53037
53049
|
this.mouse.onDrag = (delta, button) => {
|
|
53038
53050
|
if (button === 0) {
|
|
53039
|
-
if (this.
|
|
53040
|
-
if (this.
|
|
53041
|
-
if (this.
|
|
53042
|
-
if (this.
|
|
53051
|
+
if (this.pointerActive === "orbit") adapter.orbitCamera(toRotation(delta, this.orbitSpeed));
|
|
53052
|
+
if (this.pointerActive === "look") adapter.rotateCamera(toRotation(delta, this.rotateSpeed));
|
|
53053
|
+
if (this.pointerActive === "pan") adapter.panCamera(delta);
|
|
53054
|
+
if (this.pointerActive === "zoom") adapter.dollyCamera(delta);
|
|
53055
|
+
}
|
|
53056
|
+
if (button === 2) {
|
|
53057
|
+
this.pointerOverride = "look";
|
|
53058
|
+
adapter.rotateCamera(toRotation(delta, 1));
|
|
53059
|
+
}
|
|
53060
|
+
if (button === 1) {
|
|
53061
|
+
this.pointerOverride = "pan";
|
|
53062
|
+
adapter.panCamera(delta);
|
|
53043
53063
|
}
|
|
53044
|
-
if (button === 2) adapter.rotateCamera(toRotation(delta, 1));
|
|
53045
|
-
if (button === 1) adapter.panCamera(delta);
|
|
53046
53064
|
};
|
|
53047
53065
|
this.mouse.onClick = (pos, modif) => adapter.selectAtPointer(pos, modif);
|
|
53048
53066
|
this.mouse.onDoubleClick = adapter.frameAtPointer;
|
|
@@ -55920,9 +55938,7 @@ void main() {
|
|
|
55920
55938
|
viewer.camera.orthographic = !viewer.camera.orthographic;
|
|
55921
55939
|
},
|
|
55922
55940
|
toggleCameraOrbitMode: () => {
|
|
55923
|
-
|
|
55924
|
-
this._pointerFallback = this._pointerActive;
|
|
55925
|
-
this._onPointerModeChanged.dispatch();
|
|
55941
|
+
viewer.inputs.pointerActive = viewer.inputs.pointerActive === PointerMode$1.ORBIT ? PointerMode$1.LOOK : PointerMode$1.ORBIT;
|
|
55926
55942
|
},
|
|
55927
55943
|
resetCamera: () => {
|
|
55928
55944
|
viewer.camera.lerp(0.75).reset();
|