@glyphcss/react 0.0.6 → 0.0.7
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/index.cjs +5 -20
- package/dist/index.d.cts +15 -5
- package/dist/index.d.ts +15 -5
- package/dist/index.js +5 -20
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -700,28 +700,15 @@ function GlyphMapControls({
|
|
|
700
700
|
// src/glyphcss/controls/GlyphFirstPersonControls.tsx
|
|
701
701
|
var import_react13 = require("react");
|
|
702
702
|
var import_glyphcss7 = require("glyphcss");
|
|
703
|
-
function GlyphFirstPersonControls({
|
|
704
|
-
drag = true,
|
|
705
|
-
keyboard = true,
|
|
706
|
-
moveSpeed = 0.05,
|
|
707
|
-
lookSpeed = 4e-3,
|
|
708
|
-
invert = false
|
|
709
|
-
}) {
|
|
703
|
+
function GlyphFirstPersonControls(props) {
|
|
710
704
|
const { sceneRef } = useGlyphSceneContext();
|
|
711
705
|
const controlsRef = (0, import_react13.useRef)(null);
|
|
712
|
-
const propsRef = (0, import_react13.useRef)(
|
|
713
|
-
propsRef.current =
|
|
706
|
+
const propsRef = (0, import_react13.useRef)(props);
|
|
707
|
+
propsRef.current = props;
|
|
714
708
|
(0, import_react13.useEffect)(() => {
|
|
715
709
|
const scene = sceneRef.current;
|
|
716
710
|
if (!scene) return;
|
|
717
|
-
const
|
|
718
|
-
drag: propsRef.current.drag,
|
|
719
|
-
keyboard: propsRef.current.keyboard,
|
|
720
|
-
moveSpeed: propsRef.current.moveSpeed,
|
|
721
|
-
lookSpeed: propsRef.current.lookSpeed,
|
|
722
|
-
invert: propsRef.current.invert
|
|
723
|
-
};
|
|
724
|
-
const controls = (0, import_glyphcss7.createGlyphFirstPersonControls)(scene, opts);
|
|
711
|
+
const controls = (0, import_glyphcss7.createGlyphFirstPersonControls)(scene, propsRef.current);
|
|
725
712
|
controlsRef.current = controls;
|
|
726
713
|
return () => {
|
|
727
714
|
controls.destroy();
|
|
@@ -729,9 +716,7 @@ function GlyphFirstPersonControls({
|
|
|
729
716
|
};
|
|
730
717
|
}, [sceneRef]);
|
|
731
718
|
(0, import_react13.useEffect)(() => {
|
|
732
|
-
|
|
733
|
-
if (!controls) return;
|
|
734
|
-
controls.update({ drag, keyboard, moveSpeed, lookSpeed, invert });
|
|
719
|
+
controlsRef.current?.update(props);
|
|
735
720
|
});
|
|
736
721
|
return null;
|
|
737
722
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -236,13 +236,23 @@ interface GlyphMapControlsProps {
|
|
|
236
236
|
declare function GlyphMapControls({ drag, wheel, invert, animate, }: GlyphMapControlsProps): null;
|
|
237
237
|
|
|
238
238
|
interface GlyphFirstPersonControlsProps {
|
|
239
|
-
|
|
240
|
-
|
|
239
|
+
enabled?: boolean;
|
|
240
|
+
lookEnabled?: boolean;
|
|
241
|
+
moveEnabled?: boolean;
|
|
242
|
+
jumpEnabled?: boolean;
|
|
243
|
+
crouchEnabled?: boolean;
|
|
244
|
+
lookSensitivity?: number;
|
|
245
|
+
invertY?: boolean;
|
|
241
246
|
moveSpeed?: number;
|
|
242
|
-
|
|
243
|
-
|
|
247
|
+
jumpVelocity?: number;
|
|
248
|
+
gravity?: number;
|
|
249
|
+
eyeHeight?: number;
|
|
250
|
+
crouchHeight?: number;
|
|
251
|
+
groundZ?: number;
|
|
252
|
+
minPitch?: number;
|
|
253
|
+
maxPitch?: number;
|
|
244
254
|
}
|
|
245
|
-
declare function GlyphFirstPersonControls(
|
|
255
|
+
declare function GlyphFirstPersonControls(props: GlyphFirstPersonControlsProps): null;
|
|
246
256
|
|
|
247
257
|
interface GlyphAxesHelperProps {
|
|
248
258
|
/** Length of each axis bar in world units. Default 1. */
|
package/dist/index.d.ts
CHANGED
|
@@ -236,13 +236,23 @@ interface GlyphMapControlsProps {
|
|
|
236
236
|
declare function GlyphMapControls({ drag, wheel, invert, animate, }: GlyphMapControlsProps): null;
|
|
237
237
|
|
|
238
238
|
interface GlyphFirstPersonControlsProps {
|
|
239
|
-
|
|
240
|
-
|
|
239
|
+
enabled?: boolean;
|
|
240
|
+
lookEnabled?: boolean;
|
|
241
|
+
moveEnabled?: boolean;
|
|
242
|
+
jumpEnabled?: boolean;
|
|
243
|
+
crouchEnabled?: boolean;
|
|
244
|
+
lookSensitivity?: number;
|
|
245
|
+
invertY?: boolean;
|
|
241
246
|
moveSpeed?: number;
|
|
242
|
-
|
|
243
|
-
|
|
247
|
+
jumpVelocity?: number;
|
|
248
|
+
gravity?: number;
|
|
249
|
+
eyeHeight?: number;
|
|
250
|
+
crouchHeight?: number;
|
|
251
|
+
groundZ?: number;
|
|
252
|
+
minPitch?: number;
|
|
253
|
+
maxPitch?: number;
|
|
244
254
|
}
|
|
245
|
-
declare function GlyphFirstPersonControls(
|
|
255
|
+
declare function GlyphFirstPersonControls(props: GlyphFirstPersonControlsProps): null;
|
|
246
256
|
|
|
247
257
|
interface GlyphAxesHelperProps {
|
|
248
258
|
/** Length of each axis bar in world units. Default 1. */
|
package/dist/index.js
CHANGED
|
@@ -656,28 +656,15 @@ function GlyphMapControls({
|
|
|
656
656
|
// src/glyphcss/controls/GlyphFirstPersonControls.tsx
|
|
657
657
|
import { useEffect as useEffect9, useRef as useRef10 } from "react";
|
|
658
658
|
import { createGlyphFirstPersonControls } from "glyphcss";
|
|
659
|
-
function GlyphFirstPersonControls({
|
|
660
|
-
drag = true,
|
|
661
|
-
keyboard = true,
|
|
662
|
-
moveSpeed = 0.05,
|
|
663
|
-
lookSpeed = 4e-3,
|
|
664
|
-
invert = false
|
|
665
|
-
}) {
|
|
659
|
+
function GlyphFirstPersonControls(props) {
|
|
666
660
|
const { sceneRef } = useGlyphSceneContext();
|
|
667
661
|
const controlsRef = useRef10(null);
|
|
668
|
-
const propsRef = useRef10(
|
|
669
|
-
propsRef.current =
|
|
662
|
+
const propsRef = useRef10(props);
|
|
663
|
+
propsRef.current = props;
|
|
670
664
|
useEffect9(() => {
|
|
671
665
|
const scene = sceneRef.current;
|
|
672
666
|
if (!scene) return;
|
|
673
|
-
const
|
|
674
|
-
drag: propsRef.current.drag,
|
|
675
|
-
keyboard: propsRef.current.keyboard,
|
|
676
|
-
moveSpeed: propsRef.current.moveSpeed,
|
|
677
|
-
lookSpeed: propsRef.current.lookSpeed,
|
|
678
|
-
invert: propsRef.current.invert
|
|
679
|
-
};
|
|
680
|
-
const controls = createGlyphFirstPersonControls(scene, opts);
|
|
667
|
+
const controls = createGlyphFirstPersonControls(scene, propsRef.current);
|
|
681
668
|
controlsRef.current = controls;
|
|
682
669
|
return () => {
|
|
683
670
|
controls.destroy();
|
|
@@ -685,9 +672,7 @@ function GlyphFirstPersonControls({
|
|
|
685
672
|
};
|
|
686
673
|
}, [sceneRef]);
|
|
687
674
|
useEffect9(() => {
|
|
688
|
-
|
|
689
|
-
if (!controls) return;
|
|
690
|
-
controls.update({ drag, keyboard, moveSpeed, lookSpeed, invert });
|
|
675
|
+
controlsRef.current?.update(props);
|
|
691
676
|
});
|
|
692
677
|
return null;
|
|
693
678
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glyphcss/react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "React components for the glyphcss ASCII polygon mesh rendering engine",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"glyphcss": "^0.0.
|
|
44
|
-
"@glyphcss/core": "^0.0.
|
|
43
|
+
"glyphcss": "^0.0.7",
|
|
44
|
+
"@glyphcss/core": "^0.0.7"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"react": "^18.0.0 || ^19.0.0",
|