Skip to content

Commit e55f0ee

Browse files
committed
feat: Shape Lab, defaults calibrados, posicoes e migracao de icones
- Shape Lab (DevPanel): abas Shapes/Posicoes pra calibrar defaults de cada shape e copiar offsets de posicionamento; placeholder visivel do minimapa no modo dev pra facilitar alinhamento - types.ts: defaults de estilo por shapekind calibrados no lab (ringSize=4 real ja que o kit normaliza o stroke, iconScaling/translate/round/etc), badge remapeado pro novo modelo, shape "transparent" removida - migracao versionada (ICON_DEFAULTS_VERSION): reconstroi o estilo dos icones salvos a partir do shape ao subir a versao, sem perder shape/visibilidade/icone/cores nem exigir reset manual - sobe @mriqbox/ui-kit pra 4.14.0 - posicoes base de speedometer/fuelgauge/seatbelt/aircraftHorizon calibradas - fix: updateAllIconsSettings tambem atualiza globalIconSettings (steppers globais de tamanho estavam presos no valor antigo) - fix: SingleStatusIconPanel sincroniza editSingleIcon via useEffect (era setState no corpo do render)
1 parent c579e35 commit e55f0ee

11 files changed

Lines changed: 430 additions & 61 deletions

File tree

web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"@fortawesome/free-regular-svg-icons": "^6.7.2",
1515
"@fortawesome/free-solid-svg-icons": "^6.7.2",
1616
"@fortawesome/react-fontawesome": "^0.2.2",
17-
"@mriqbox/ui-kit": "^4.11.0",
17+
"@mriqbox/ui-kit": "^4.14.0",
1818
"@radix-ui/react-checkbox": "^1.1.4",
1919
"@radix-ui/react-label": "^2.1.2",
2020
"@radix-ui/react-select": "^2.1.6",

web/pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/src/components/menu/SingleStatusIconPanel.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useState } from "react";
1+
import { useEffect, useState } from "react";
22
import { shapes, iconNames } from "../../types/types";
33
import { usePlayerStatusHudStore } from "../../stores/playerStatusHudStore";
44
import { useColorEffectStore } from "../../stores/colorEffectStore";
@@ -35,10 +35,14 @@ export default function SingleStatusIconPanel() {
3535
const iconIndex = iconNames.indexOf(iconName);
3636
const panelIconColor = iconColors[iconIndex] ?? "#FFFFFF";
3737

38-
// Sync editSingleIconName/Stage into globalColorSettings for design-mode preview
39-
useColorEffectStore.setState((s) => ({
40-
globalColorSettings: { ...s.globalColorSettings, editSingleIconName: iconName, editSingleIconStage: stageIndex },
41-
}));
38+
// Sync editSingleIconName/Stage into globalColorSettings for design-mode preview.
39+
// Em useEffect (nao no corpo do render) pra nao disparar setState durante o
40+
// render — isso causava re-renders extras e travava a interacao dos controles.
41+
useEffect(() => {
42+
useColorEffectStore.setState((s) => ({
43+
globalColorSettings: { ...s.globalColorSettings, editSingleIconName: iconName, editSingleIconStage: stageIndex },
44+
}));
45+
}, [iconName, stageIndex]);
4246

4347
function handleIconChange(name: string) {
4448
setIconName(name as iconNamesKind);

web/src/components/organisms/AircraftHud.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default function AircraftHud() {
2626
return (
2727
<>
2828
<DraggableHudElement id="aircraftHorizon" label="Horizonte" zIndex={15}>
29-
<ScaledHudContent style={{ position: "fixed", bottom: "2vh", left: "43vw", pointerEvents: "none" }}>
29+
<ScaledHudContent style={{ position: "fixed", bottom: "2.16vh", left: "43.43vw", pointerEvents: "none" }}>
3030
<ArtificialHorizon size={160} pitch={pitch} roll={roll} />
3131
</ScaledHudContent>
3232
</DraggableHudElement>

web/src/components/organisms/DevPanel.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ import {
77
import { usePositioningStore } from "../../stores/positioningStore";
88
import { useMenuStore } from "../../stores/menuStore";
99
import { usePlayerStatusHudStore } from "../../stores/playerStatusHudStore";
10+
import ShapeLab from "./ShapeLab";
1011

1112
export default function DevPanel() {
1213
const [open, setOpen] = useState(false);
14+
const [shapeLab, setShapeLab] = useState(false);
1315

1416
const positioningActive = usePositioningStore((s) => s.active);
1517
const togglePositioning = usePositioningStore((s) => s.toggle);
@@ -76,6 +78,13 @@ export default function DevPanel() {
7678
}
7779
/>
7880

81+
<DevButton
82+
icon={faVectorSquare}
83+
label="Shape Lab"
84+
active={shapeLab}
85+
onClick={() => setShapeLab((v) => !v)}
86+
/>
87+
7988
{positioningActive && (
8089
<button
8190
onClick={resetAll}
@@ -121,6 +130,8 @@ export default function DevPanel() {
121130
<FontAwesomeIcon icon={faCode} />
122131
<FontAwesomeIcon icon={open ? faChevronDown : faChevronUp} style={{ fontSize: 9 }} />
123132
</button>
133+
134+
{shapeLab && <ShapeLab onClose={() => setShapeLab(false)} />}
124135
</div>
125136
);
126137
}

web/src/components/organisms/MapBorderHud.tsx

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ export default function MapBorderHud() {
2626
label="Minimapa"
2727
zIndex={8}
2828
>
29-
{/* Sem moldura custom — o minimap usa a borda nativa do GTA. Este
30-
placeholder e invisivel (sem borda/fundo) e existe so pra dar bounds
31-
ao DraggableHudElement no modo posicionamento, que mede o selection
32-
box e a area de arraste a partir dos filhos. */}
29+
{/* Em producao o minimap usa a borda nativa do GTA; este box e so pra
30+
dar bounds ao DraggableHudElement. No modo dev (sem jogo atras) ele
31+
vira um placeholder visivel pra facilitar alinhar os elementos. */}
3332
<div
3433
style={{
3534
position: "absolute",
@@ -46,10 +45,25 @@ export default function MapBorderHud() {
4645
width: "29vh",
4746
height: "18.5vh",
4847
position: "absolute",
49-
display: "inline-block",
48+
display: "inline-flex",
49+
alignItems: "center",
50+
justifyContent: "center",
5051
pointerEvents: "none",
52+
...(debugMode
53+
? {
54+
border: "2px dashed rgba(147,197,253,0.5)",
55+
background: "rgba(59,130,246,0.07)",
56+
borderRadius: 4,
57+
color: "rgba(147,197,253,0.7)",
58+
fontFamily: "monospace",
59+
fontSize: 12,
60+
letterSpacing: "0.1em",
61+
}
62+
: {}),
5163
}}
52-
/>
64+
>
65+
{debugMode && "MINIMAPA"}
66+
</div>
5367
</div>
5468
</DraggableHudElement>
5569
);

0 commit comments

Comments
 (0)