Skip to content

Commit

Permalink
feat: sizing
Browse files Browse the repository at this point in the history
  • Loading branch information
tresabhi committed Dec 2, 2024
1 parent 7188014 commit 74ac5b5
Showing 1 changed file with 19 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export function SceneProps() {
(state) => state.showGrid && !state.showEnvironment,
);
const targetCircle = useRef<Group>(null);
const targetCircleDots = useRef<HTMLDivElement>(null);
const texture = useLoader(TextureLoader, 'https://i.imgur.com/C28Z8nU.png');

texture.anisotropy = 2;
Expand Down Expand Up @@ -93,7 +94,8 @@ export function SceneProps() {
!playground.current ||
!shellPathHelper.current ||
!targetCircle.current ||
DEBUG_disable
DEBUG_disable ||
!targetCircleDots.current
) {
return;
}
Expand Down Expand Up @@ -171,6 +173,10 @@ export function SceneProps() {

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) => {
// if (event.key === 'Enter') {
// DEBUG_disable = true;
Expand All @@ -192,25 +198,24 @@ export function SceneProps() {
<arrowHelper ref={shellPathHelper} position={shellOrigin} />

<group ref={targetCircle}>
<mesh>
{/* <sphereGeometry args={[0.1, 32, 32]} />
{/* <sphereGeometry args={[0.1, 32, 32]} />
<meshStandardMaterial
depthTest={false}
depthWrite={false}
color="red"
/> */}

<Html center occlude={false}>
<Box
width="10em"
height="10em"
style={{
borderRadius: '50%',
border: `0.25rem dotted ${Var('gray-12')}`,
}}
/>
</Html>
</mesh>
<Html center occlude={false}>
<Box
ref={targetCircleDots}
width="10em"
height="10em"
style={{
borderRadius: '50%',
border: `0.25rem dotted ${Var('gray-12')}`,
}}
/>
</Html>
</group>

<group ref={playground}>
Expand Down

0 comments on commit 74ac5b5

Please sign in to comment.