minerender 2.1.0-alpha.117 → 2.1.0-alpha.118
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/browser/index.d.mts +11 -2
- package/dist/browser/index.d.ts +11 -2
- package/dist/browser/index.js +43 -6
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +43 -6
- package/dist/browser/index.mjs.map +1 -1
- package/dist/bundle.js +43 -6
- package/dist/bundle.js.map +1 -1
- package/dist/node/index.d.mts +11 -2
- package/dist/node/index.d.ts +11 -2
- package/dist/node/index.js +43 -6
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +43 -6
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -101542,6 +101542,8 @@ property list uchar int vertex_index
|
|
|
101542
101542
|
var VANILLA_FLY_SPEED = 10.89;
|
|
101543
101543
|
var PITCH_LIMIT = Math.PI / 2;
|
|
101544
101544
|
var MOVE_EPSILON = 1e-6;
|
|
101545
|
+
var MAX_STEP_SECONDS = 0.1;
|
|
101546
|
+
var CLICK_SLOP_PIXELS = 4;
|
|
101545
101547
|
var _euler = new Euler(0, 0, 0, "YXZ");
|
|
101546
101548
|
var _forward = new Vector3();
|
|
101547
101549
|
var _right = new Vector3();
|
|
@@ -101576,7 +101578,8 @@ property list uchar int vertex_index
|
|
|
101576
101578
|
right: ["KeyD", "ArrowRight"],
|
|
101577
101579
|
up: ["Space"],
|
|
101578
101580
|
down: ["ShiftLeft", "ShiftRight"],
|
|
101579
|
-
|
|
101581
|
+
// Not Control: Ctrl+W closes the browser tab on Windows and Linux, and a page cannot block it.
|
|
101582
|
+
sprint: ["KeyR"]
|
|
101580
101583
|
};
|
|
101581
101584
|
this._pressed = /* @__PURE__ */ new Set();
|
|
101582
101585
|
this._velocity = new Vector3();
|
|
@@ -101584,8 +101587,12 @@ property list uchar int vertex_index
|
|
|
101584
101587
|
this._lastQuaternion = new Quaternion();
|
|
101585
101588
|
this._position0 = new Vector3();
|
|
101586
101589
|
this._quaternion0 = new Quaternion();
|
|
101590
|
+
this._dragX = 0;
|
|
101591
|
+
this._dragY = 0;
|
|
101587
101592
|
this._dragMoved = false;
|
|
101593
|
+
this._dragTravel = 0;
|
|
101588
101594
|
this._locked = false;
|
|
101595
|
+
this._madeFocusable = false;
|
|
101589
101596
|
this._onKeyDown = (event) => this.handleKey(event, true);
|
|
101590
101597
|
this._onKeyUp = (event) => this.handleKey(event, false);
|
|
101591
101598
|
this._onPointerDown = (event) => this.handlePointerDown(event);
|
|
@@ -101615,7 +101622,10 @@ property list uchar int vertex_index
|
|
|
101615
101622
|
element.addEventListener("wheel", this._onWheel, { passive: false });
|
|
101616
101623
|
element.addEventListener("blur", this._onBlur);
|
|
101617
101624
|
element.style.touchAction = "none";
|
|
101618
|
-
if (element.tabIndex < 0)
|
|
101625
|
+
if (element.tabIndex < 0) {
|
|
101626
|
+
element.tabIndex = 0;
|
|
101627
|
+
this._madeFocusable = true;
|
|
101628
|
+
}
|
|
101619
101629
|
}
|
|
101620
101630
|
disconnect() {
|
|
101621
101631
|
const element = this.domElement;
|
|
@@ -101633,6 +101643,10 @@ property list uchar int vertex_index
|
|
|
101633
101643
|
element.removeEventListener("wheel", this._onWheel);
|
|
101634
101644
|
element.removeEventListener("blur", this._onBlur);
|
|
101635
101645
|
element.style.touchAction = "auto";
|
|
101646
|
+
if (this._madeFocusable) {
|
|
101647
|
+
element.removeAttribute("tabindex");
|
|
101648
|
+
this._madeFocusable = false;
|
|
101649
|
+
}
|
|
101636
101650
|
this.unlock();
|
|
101637
101651
|
this._locked = false;
|
|
101638
101652
|
this.releaseKeys();
|
|
@@ -101703,6 +101717,7 @@ property list uchar int vertex_index
|
|
|
101703
101717
|
/**
|
|
101704
101718
|
* Advances movement by `delta` seconds (measured since the previous call when omitted)
|
|
101705
101719
|
* and dispatches `change` when the camera moved.
|
|
101720
|
+
* A step longer than 0.1 s is applied as 0.1 s.
|
|
101706
101721
|
*/
|
|
101707
101722
|
update(delta) {
|
|
101708
101723
|
if (delta === void 0) {
|
|
@@ -101714,7 +101729,7 @@ property list uchar int vertex_index
|
|
|
101714
101729
|
this._velocity.set(0, 0, 0);
|
|
101715
101730
|
return;
|
|
101716
101731
|
}
|
|
101717
|
-
if (delta > 0) this.move(delta);
|
|
101732
|
+
if (delta > 0) this.move(Math.min(delta, MAX_STEP_SECONDS));
|
|
101718
101733
|
this.notifyChange();
|
|
101719
101734
|
}
|
|
101720
101735
|
move(delta) {
|
|
@@ -101761,15 +101776,21 @@ property list uchar int vertex_index
|
|
|
101761
101776
|
this._pressed.clear();
|
|
101762
101777
|
}
|
|
101763
101778
|
handleKey(event, down) {
|
|
101779
|
+
if (event.code === "MetaLeft" || event.code === "MetaRight") this.releaseKeys();
|
|
101764
101780
|
const action = this.actionFor(event.code);
|
|
101765
101781
|
if (!action) return;
|
|
101766
101782
|
const ownsInput = this.enabled && (this._locked || event.target === this.domElement);
|
|
101767
|
-
if (down && !ownsInput) return;
|
|
101783
|
+
if (down && (!ownsInput || this.isBrowserShortcut(event))) return;
|
|
101768
101784
|
const pressed = this._pressed.has(action);
|
|
101769
101785
|
if (down) this._pressed.add(action);
|
|
101770
101786
|
else this._pressed.delete(action);
|
|
101771
101787
|
if (ownsInput || this.enabled && pressed) event.preventDefault();
|
|
101772
101788
|
}
|
|
101789
|
+
/** A key pressed with Control, Alt, or Command stays a browser shortcut unless that modifier is bound to an action. */
|
|
101790
|
+
isBrowserShortcut(event) {
|
|
101791
|
+
const bound = (modifier) => Object.values(this.keys).some((codes2) => codes2.some((code2) => code2.startsWith(modifier)));
|
|
101792
|
+
return event.ctrlKey && !bound("Control") || event.altKey && !bound("Alt") || event.metaKey && !bound("Meta");
|
|
101793
|
+
}
|
|
101773
101794
|
actionFor(code2) {
|
|
101774
101795
|
for (const action in this.keys) {
|
|
101775
101796
|
if (this.keys[action].includes(code2)) return action;
|
|
@@ -101789,7 +101810,10 @@ property list uchar int vertex_index
|
|
|
101789
101810
|
if (this._dragPointer !== void 0) return;
|
|
101790
101811
|
if (event.pointerType === "mouse" && event.button !== 0 && event.button !== 2) return;
|
|
101791
101812
|
this._dragPointer = event.pointerId;
|
|
101813
|
+
this._dragX = event.clientX;
|
|
101814
|
+
this._dragY = event.clientY;
|
|
101792
101815
|
this._dragMoved = false;
|
|
101816
|
+
this._dragTravel = 0;
|
|
101793
101817
|
element.setPointerCapture?.(event.pointerId);
|
|
101794
101818
|
}
|
|
101795
101819
|
onJoystickSide(event) {
|
|
@@ -101805,8 +101829,20 @@ property list uchar int vertex_index
|
|
|
101805
101829
|
return;
|
|
101806
101830
|
}
|
|
101807
101831
|
if (!this._locked && event.pointerId !== this._dragPointer) return;
|
|
101808
|
-
|
|
101809
|
-
|
|
101832
|
+
let dx, dy;
|
|
101833
|
+
if (this._locked) {
|
|
101834
|
+
dx = event.movementX ?? 0;
|
|
101835
|
+
dy = event.movementY ?? 0;
|
|
101836
|
+
} else {
|
|
101837
|
+
dx = event.clientX - this._dragX;
|
|
101838
|
+
dy = event.clientY - this._dragY;
|
|
101839
|
+
this._dragX = event.clientX;
|
|
101840
|
+
this._dragY = event.clientY;
|
|
101841
|
+
if (!this._dragMoved) {
|
|
101842
|
+
this._dragTravel += Math.hypot(dx, dy);
|
|
101843
|
+
if (this._dragTravel <= CLICK_SLOP_PIXELS) return;
|
|
101844
|
+
}
|
|
101845
|
+
}
|
|
101810
101846
|
if (!dx && !dy) return;
|
|
101811
101847
|
this._dragMoved = true;
|
|
101812
101848
|
this.turn(dx, dy);
|
|
@@ -105719,6 +105755,7 @@ gl_FragDepth=readDepth(vUv);
|
|
|
105719
105755
|
/**
|
|
105720
105756
|
* Replaces renderer-owned controls with the selected mode, keeping the camera where it is.
|
|
105721
105757
|
* Switching to orbit controls targets the point the camera looks at, at the previous orbit distance.
|
|
105758
|
+
* The previous controls object is disposed, so its listeners and settings do not carry over.
|
|
105722
105759
|
* Returns the new controls, or undefined when controls were disabled at construction or after disposal.
|
|
105723
105760
|
*/
|
|
105724
105761
|
setControlsMode(mode2) {
|