diff --git a/package.json b/package.json index 1cb9a53..6e247ff 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vite_react_shadcn_ts", "private": true, - "version": "1.0.3", + "version": "1.0.4", "type": "module", "scripts": { "dev": "vite", diff --git a/src/pages/Index.tsx b/src/pages/Index.tsx index d462d2a..df44d2b 100644 --- a/src/pages/Index.tsx +++ b/src/pages/Index.tsx @@ -310,7 +310,7 @@ const Index = () => { {/* Footer */}

- TrackSteelXR v1.03 — Q.C. Inspection + TrackSteelXR v1.04 — Q.C. Inspection

); diff --git a/src/pages/XRSession.tsx b/src/pages/XRSession.tsx index 5e7da1b..7826d80 100644 --- a/src/pages/XRSession.tsx +++ b/src/pages/XRSession.tsx @@ -307,6 +307,61 @@ function ControllerFineTuning({ freeMove }: { freeMove: boolean }) { return null; } +// Componente de renderização de texto compatível e seguro para WebXR +function XRMeasurementText({ text, color }: { text: string; color: string }) { + const texture = useMemo(() => { + const canvas = document.createElement('canvas'); + canvas.width = 256; + canvas.height = 64; + const ctx = canvas.getContext('2d'); + if (ctx) { + // Limpa e desenha fundo semi-transparente + ctx.fillStyle = 'rgba(11, 18, 32, 0.85)'; + ctx.beginPath(); + // Desenha retângulo arredondado manualmente + const x = 0, y = 0, width = 256, height = 64, radius = 12; + ctx.moveTo(x + radius, y); + ctx.lineTo(x + width - radius, y); + ctx.quadraticCurveTo(x + width, y, x + width, y + radius); + ctx.lineTo(x + width, y + height - radius); + ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height); + ctx.lineTo(x + radius, y + height); + ctx.quadraticCurveTo(x, y + height, x, y + height - radius); + ctx.lineTo(x, y + radius); + ctx.quadraticCurveTo(x, y, x + radius, y); + ctx.closePath(); + ctx.fill(); + + // Desenha borda sutil + ctx.strokeStyle = color; + ctx.lineWidth = 3; + ctx.stroke(); + + // Texto + ctx.fillStyle = color; + ctx.font = 'bold 24px monospace'; + ctx.textAlign = 'center'; + ctx.textBaseline = 'middle'; + ctx.fillText(text, 128, 32); + } + const tex = new THREE.CanvasTexture(canvas); + tex.colorSpace = THREE.SRGBColorSpace; + return tex; + }, [text, color]); + + return ( + + + + + ); +} + // ─── Measurement overlay (reused from ModelViewer) ───── function XRMeasurementOverlay() { const measurements = useModelStore((s) => s.measurements); @@ -345,21 +400,7 @@ function XRMeasurementOverlay() { )} - - - - - - {text} - + );