From 63ad53edfbad4f979512a07ea5527a9d85b44cac Mon Sep 17 00:00:00 2001 From: admtracksteel Date: Fri, 22 May 2026 21:07:04 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20Auto-deploy:=20melhoria=20no=20s?= =?UTF-8?q?nap=20e=20medi=C3=A7=C3=A3o=20AR=20em=2022/05/2026=2021:07:04?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/pages/Index.tsx | 2 +- src/pages/XRSession.tsx | 71 ++++++++++++++++++++++++++++++++--------- 3 files changed, 58 insertions(+), 17 deletions(-) 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} - + );