Cómo funciona
An 8 × 3 m room drawn twice: as a plan, the orthographic view from straight above with x and y rulers, and as an axonometric view. A cube, a cylinder and a square pyramid stand in it. The plan shows only their footprints (a square, a circle, a square with its sloping edges), which is what a top view keeps; the axonometric view shows their heights. The chosen solid is drawn in the accent in both views, with dashed guides from its centre to both axes and its coordinates on the rulers. Solids snap to the grid and cannot overlap.
Úsalo para
- Teach how a plan (top view) relates to a 3D view of the same objects.
- Read and set coordinates on a plan.
Busca otra opción cuando
- The room and the three solids are fixed; for a real floor plan with your own objects use a drawing tool.
Uso
import { TwinViewExhibitLayout } from './TwinViewExhibitLayout.jsx'
export function Lesson({ save }) {
return <TwinViewExhibitLayout defaultPositions={[{ id: '02', x: 4.5, y: 1.5 }]} onChange={save} />
}Propiedades
| Propiedad | Tipo | Por defecto | Qué hace |
|---|---|---|---|
title | string | 'Plan and axonometric view' | Heading of the card. |
titles | string[] | — | Names of the cube, the cylinder and the pyramid, in that order. |
labels | object | — | Text overrides: caption, plan, model, move, left, up, down, right, instructions, position and reset. move and position take {name}; position also takes {x} and {y}. |
defaultPositions | Array<{ id: string, x: number, y: number }> | — | Starting centres in metres from the back-left corner of the 8 × 3 m room. IDs are '01' (cube), '02' (cylinder) and '03' (pyramid); a missing one keeps its default. |
step | 0.25 | 0.5 | 0.25 | Grid step in metres for dragging, the arrow keys and the pad. |
onChange | (positions: Array<{ id: string, x: number, y: number }>) => void | — | Receives all three centres after a drag, a pad press, Enter, a change of solid, leaving the card or Reset. Escape and a cancelled touch put the solid back and do not call it. |
locale | string | 'en' | Locale for the coordinate numbers. |
className | string | — | Extra class on the root. |
Accesibilidad
- Each footprint on the plan is a button: Tab reaches it and selects it, the arrow keys move it one grid step, Enter confirms and Escape puts it back. Changing solid or leaving the card also confirms.
- The arrow pad works for touch and switch users and shows when a move is blocked by a wall or another solid. A status line reads the chosen solid and its coordinates. A cancelled touch puts the solid back.
Movimiento
Both views redraw directly as a solid moves, so the 3D view tracks the finger. Only colours and the pressed scale of buttons transition, and reduced motion removes those.
Añádelo a tu proyecto
Los miembros Pro copian un prompt y su agente de programación instala el código, igual que con los gratuitos.
TwinViewExhibitLayout.jsxtwin-view-exhibit-layout.csstokens.cssREADME.md
Los dos archivos se instalan juntos. La hoja de estilos lee las variables de tokens.css y lleva valores de reserva, así que también funciona sola.







