diff --git a/packages/react/src/scene/atlas/atlasPoly.tsx b/packages/react/src/scene/atlas/atlasPoly.tsx index cff10f27..4d85b3b5 100644 --- a/packages/react/src/scene/atlas/atlasPoly.tsx +++ b/packages/react/src/scene/atlas/atlasPoly.tsx @@ -50,10 +50,18 @@ export const TextureAtlasPoly = memo(function TextureAtlasPoly({ const style: CSSProperties = { transform: formatMatrix3d(entry.atlasMatrix), ["--polycss-atlas-size" as string]: `${atlasCanonicalSize}px`, - background, - backgroundImage: dynamic && page?.url ? `url(${page.url})` : undefined, - backgroundPosition: dynamic ? atlasPosition : undefined, - backgroundSize: dynamic ? atlasSize : undefined, + // Listing the `background` shorthand alongside the `background-*` longhands + // in one inline style object makes React warn on every update (mixing + // shorthand and non-shorthand for the same property). Branch so only the + // current mode's keys are assigned — baked gets `background`, dynamic gets + // the longhands. + ...(dynamic + ? { + backgroundImage: page?.url ? `url(${page.url})` : undefined, + backgroundPosition: atlasPosition, + backgroundSize: atlasSize, + } + : { background }), ...(dynamic ? { ["--pnx" as string]: entry.normal[0].toFixed(4), diff --git a/website/src/components/WordArtWorkbench/WordArtWorkbench.tsx b/website/src/components/WordArtWorkbench/WordArtWorkbench.tsx index 229c9cf7..4367711c 100644 --- a/website/src/components/WordArtWorkbench/WordArtWorkbench.tsx +++ b/website/src/components/WordArtWorkbench/WordArtWorkbench.tsx @@ -157,6 +157,8 @@ export function WordArtWorkbench() { const [lightEl, setLightEl] = useState(() => qn("lel", 45)); const [activePreset, setActivePreset] = useState(null); const [exporting, setExporting] = useState(false); + // Mobile: only one floating panel is open at a time, toggled by the bottom tabs. + const [mobilePanel, setMobilePanel] = useState<"style" | "controls" | null>(null); const handleCodePen = async () => { const el = document.querySelector(".wa-stage .polycss-camera") @@ -173,6 +175,13 @@ export function WordArtWorkbench() { } }; + useEffect(() => { + if (!mobilePanel) return; + const onKey = (e: KeyboardEvent) => { if (e.key === "Escape") setMobilePanel(null); }; + window.addEventListener("keydown", onKey); + return () => window.removeEventListener("keydown", onKey); + }, [mobilePanel]); + // Default bundled font + Google catalog. If the URL named a font, select it // once the catalog is in. useEffect(() => { @@ -366,7 +375,11 @@ export function WordArtWorkbench() { status={status} /> -