feat: sizing

This commit is contained in:
tresabhi committed 2024-12-01 23:54:27 -06:00
1 parent 7188014fbb
commit 74ac5b5ac2
1 file changed
+8 -3
@@ -32,6 +32,7 @@ export function SceneProps() {
(state) => state.showGrid && !state.showEnvironment, (state) => state.showGrid && !state.showEnvironment,
); );
const targetCircle = useRef<Group>(null); const targetCircle = useRef<Group>(null);
const targetCircleDots = useRef<HTMLDivElement>(null);
const texture = useLoader(TextureLoader, 'https://i.imgur.com/C28Z8nU.png'); const texture = useLoader(TextureLoader, 'https://i.imgur.com/C28Z8nU.png');
texture.anisotropy = 2; texture.anisotropy = 2;
@@ -93,7 +94,8 @@ export function SceneProps() {
!playground.current || !playground.current ||
!shellPathHelper.current || !shellPathHelper.current ||
!targetCircle.current || !targetCircle.current ||
DEBUG_disable DEBUG_disable ||
!targetCircleDots.current
) { ) {
return; return;
} }
@@ -171,6 +173,10 @@ export function SceneProps() {
targetCircle.current.position.copy(gunTarget); targetCircle.current.position.copy(gunTarget);
const targetCircleDotsSize = `${gunTarget.distanceTo(shellOrigin)}px`;
targetCircleDots.current.style.width = targetCircleDotsSize;
targetCircleDots.current.style.height = targetCircleDotsSize;
// window.addEventListener('keydown', (event) => { // window.addEventListener('keydown', (event) => {
// if (event.key === 'Enter') { // if (event.key === 'Enter') {
// DEBUG_disable = true; // DEBUG_disable = true;
@@ -192,7 +198,6 @@ export function SceneProps() {
<arrowHelper ref={shellPathHelper} position={shellOrigin} /> <arrowHelper ref={shellPathHelper} position={shellOrigin} />
<group ref={targetCircle}> <group ref={targetCircle}>
<mesh>
{/* <sphereGeometry args={[0.1, 32, 32]} /> {/* <sphereGeometry args={[0.1, 32, 32]} />
<meshStandardMaterial <meshStandardMaterial
depthTest={false} depthTest={false}
@@ -202,6 +207,7 @@ export function SceneProps() {
<Html center occlude={false}> <Html center occlude={false}>
<Box <Box
ref={targetCircleDots}
width="10em" width="10em"
height="10em" height="10em"
style={{ style={{
@@ -210,7 +216,6 @@ export function SceneProps() {
}} }}
/> />
</Html> </Html>
</mesh>
</group> </group>
<group ref={playground}> <group ref={playground}>