diff --git a/src/app/tools/tankopedia/[id]/components/Model/HeroSection.tsx b/src/app/tools/tankopedia/[id]/components/Model/HeroSection.tsx index 931213969..1207bac51 100644 --- a/src/app/tools/tankopedia/[id]/components/Model/HeroSection.tsx +++ b/src/app/tools/tankopedia/[id]/components/Model/HeroSection.tsx @@ -109,6 +109,7 @@ export function HeroSection({ id }: HeroSectionProps) { justify="center" style={{ height: '100%', + userSelect: 'none', }} > diff --git a/src/components/Armor/components/ArmorPlateDisplay.tsx b/src/components/Armor/components/ArmorPlateDisplay.tsx index 07370c593..bc2d54e61 100644 --- a/src/components/Armor/components/ArmorPlateDisplay.tsx +++ b/src/components/Armor/components/ArmorPlateDisplay.tsx @@ -14,10 +14,14 @@ export function ArmorPlateDisplay() { return ( - + diff --git a/src/components/Armor/components/ShotDisplay.tsx b/src/components/Armor/components/ShotDisplay.tsx index 2cc554454..0a33c838f 100644 --- a/src/components/Armor/components/ShotDisplay.tsx +++ b/src/components/Armor/components/ShotDisplay.tsx @@ -16,6 +16,7 @@ import { Quaternion, } from 'three'; import { J_HAT, K_HAT } from '../../../constants/axis'; +import { useFullScreen } from '../../../hooks/useFullScreen'; import * as TankopediaEphemeral from '../../../stores/tankopediaEphemeral'; import { ShotDisplayCard } from './ShotDisplayCard'; @@ -35,6 +36,7 @@ const TRACER_THICK = 1 / 32; const TRACER_THIN = TRACER_THICK / 2; export function ShotDisplay() { + const isFullscreen = useFullScreen(); const shot = TankopediaEphemeral.use((state) => state.shot); const inTracer = useRef(null); const outTracer = useRef(null); @@ -139,6 +141,8 @@ export function ShotDisplay() { ? shotStatusColors[shot.out.status] : undefined; const inTitleColor = shotStatusColors[shot.in.status]; + const tracerGoingUp = + shot.in.surfaceNormal.y + (shot.out?.surfaceNormal.y ?? 0) > 0; return ( @@ -162,19 +166,17 @@ export function ShotDisplay() { )} - + diff --git a/src/components/Armor/components/ShotDisplayCard.tsx b/src/components/Armor/components/ShotDisplayCard.tsx index 313eee2f3..55c8d85db 100644 --- a/src/components/Armor/components/ShotDisplayCard.tsx +++ b/src/components/Armor/components/ShotDisplayCard.tsx @@ -1,4 +1,11 @@ -import { Card, Flex, Inset, Separator, Text } from '@radix-ui/themes'; +import { + Card, + CardProps, + Flex, + Inset, + Separator, + Text, +} from '@radix-ui/themes'; import { ComponentProps } from 'react'; import { radToDeg } from 'three/src/math/MathUtils'; import * as TankopediaEphemeral from '../../../stores/tankopediaEphemeral'; @@ -40,13 +47,7 @@ function LayerEntry({ }) { return ( - + {layerIndex} @@ -55,13 +56,7 @@ function LayerEntry({ {layer.type === null && ( <> - + {Math.round(layer.distance * 1000).toLocaleString()} mm @@ -73,13 +68,7 @@ function LayerEntry({ )} {layer.type === ArmorType.External && ( - + {Math.round(layer.thickness).toLocaleString()} mm @@ -87,13 +76,7 @@ function LayerEntry({ {(layer.type === ArmorType.Core || layer.type === ArmorType.Spaced) && ( <> - + {Math.round(layer.thicknessAngled).toLocaleString()} {`mm${angle === undefined ? '' : ` ${Math.round(radToDeg(angle))}°`}`} @@ -108,11 +91,11 @@ function LayerEntry({ ); } -interface ShotDisplayCardProps { +interface ShotDisplayCardProps extends CardProps { shot: TankopediaEphemeral.Shot; } -export function ShotDisplayCard({ shot }: ShotDisplayCardProps) { +export function ShotDisplayCard({ shot, ...props }: ShotDisplayCardProps) { if (!shot) return null; const outTitleColor = shot.out @@ -121,7 +104,7 @@ export function ShotDisplayCard({ shot }: ShotDisplayCardProps) { const inTitleColor = shotStatusColors[shot.in.status]; return ( - + diff --git a/src/components/Armor/components/SpacedArmorSceneComponent/index.tsx b/src/components/Armor/components/SpacedArmorSceneComponent/index.tsx index a9c668127..68050dba1 100644 --- a/src/components/Armor/components/SpacedArmorSceneComponent/index.tsx +++ b/src/components/Armor/components/SpacedArmorSceneComponent/index.tsx @@ -2,6 +2,7 @@ import { useThree } from '@react-three/fiber'; import { clamp } from 'lodash'; import { useCallback, useEffect, useMemo } from 'react'; import { + Box3, Color, DoubleSide, FrontSide, @@ -149,7 +150,6 @@ export function SpacedArmorSceneComponent({ if (selectedName === undefined) { // nothing selected, go back to defaults material.opacity = opacity; - // material.transparent = opacity < 1; material.color = color; material.depthWrite = props.type !== ArmorType.External; material.side = FrontSide; @@ -164,18 +164,18 @@ export function SpacedArmorSceneComponent({ ) { // this selected, stand out! material.opacity = 1; - // material.transparent = false; material.color = color; material.depthWrite = true; material.side = DoubleSide; } else { // something else selected, become background material.opacity = 1 / 4; - // material.transparent = true; material.color = unselectedColor; material.depthWrite = props.type !== ArmorType.External; material.side = FrontSide; } + + material.transparent = material.opacity < 1; } const unsubscribe = tankopediaEphemeralStore.subscribe( @@ -198,7 +198,12 @@ export function SpacedArmorSceneComponent({ onClick(event) { event.stopPropagation(); - const { point } = event; + const bounds = new Box3().setFromObject(event.object); + const point = bounds.min + .clone() + .add(bounds.max) + .divideScalar(2) + .setY(bounds.max.y); const cameraNormal = camera.position.clone().sub(point).normalize(); const surfaceNormal = event .normal!.clone()