fix: types

This commit is contained in:
TrèsAbhi committed 2024-07-27 14:25:27 -05:00
1 parent ca002623b8
commit b0aff726b5
1 file changed
+5 -4
@@ -32,7 +32,6 @@ function to255(value: number) {
} }
type SpacedArmorSceneComponentProps = { type SpacedArmorSceneComponentProps = {
name: string;
node: Object3D; node: Object3D;
thickness: number; thickness: number;
scene: Scene; scene: Scene;
@@ -52,6 +51,7 @@ type SpacedArmorSceneComponentProps = {
} }
| { | {
static: true; static: true;
name: string;
thicknessRange: ThicknessRange; thicknessRange: ThicknessRange;
} }
); );
@@ -84,7 +84,6 @@ const unselectedColor = new Color(0x404040);
*/ */
export function SpacedArmorSceneComponent({ export function SpacedArmorSceneComponent({
node, node,
name,
thickness, thickness,
scene, scene,
clip, clip,
@@ -421,11 +420,13 @@ export function SpacedArmorSceneComponent({
*/ */
useEffect(() => { useEffect(() => {
function handleHighlightArmor(thisName?: string) { function handleHighlightArmor(thisName?: string) {
if (!props.static) return;
if (thisName === undefined) { if (thisName === undefined) {
// nothing selected, go back to defaults // nothing selected, go back to defaults
material.opacity = opacity; material.opacity = opacity;
material.color = color; material.color = color;
} else if (thisName === name) { } else if (thisName === props.name) {
// this selected, stand out! // this selected, stand out!
material.opacity = 1; material.opacity = 1;
material.color = color; material.color = color;
@@ -459,7 +460,7 @@ export function SpacedArmorSceneComponent({
: (event) => { : (event) => {
event.stopPropagation(); event.stopPropagation();
mutateTankopediaEphemeralStore((draft) => { mutateTankopediaEphemeralStore((draft) => {
draft.highlightArmor = name; draft.highlightArmor = props.name;
}); });
}, },
}); });