mirror of
https://github.com/storytold/cadcraft.git
synced 2026-11-10 04:19:59 -06:00
A model space view carries a twist (radians CCW, View.twist, serde default 0). VIEWTWIST reports it read-only. Each VPORTS tile keeps its own twist (VportTile.twist, DXF VPORT group 51 read and written; a single untiled Model view's twist is kept as a lone *Active VPORT tile). VIEW Save stores and Restore applies NamedView::twist. ZOOM fits in the twisted screen frame; zooms, pans, the 3D mouse and view.set keep it; ZOOM Previous turns it back. DVIEW starts with "Select objects or <use DVIEWBLOCK>:" (the picked objects, or the DVIEWBLOCK sample, are the only things drawn while it runs) and repeats the "Enter option [CAmera/TArget/Distance/POints/PAn/Zoom/ TWist/CLip/Hide/Off/Undo]:" prompt. TWist, PAn, Zoom, Off and Undo work on 2D views; the 3D options say they are not available yet (docs/gaps.md F1). DVIEW works inside an active layout viewport: the doc Viewport gains a view twist (DXF VIEWPORT group 51), drawn turned on screen and in plots, mapped through MSPACE views, snaps and CHSPACE; a twist made there is one undo step. A layout with no active viewport refuses it, as does view.set's twist. Canvas: the model view and every VPORTS tile draw turned by their twist. `Xf` gains `twist`: `to_screen` turns (p - centre) by it before scaling, `to_world` is its exact inverse, `world_bounds` is the box of the four turned rect corners. The GPU needs no shader change: `Xf::gpu_xform` builds the callback xform for the drawing, drag, highlight, viewport and mask layers. Pans map screen deltas back through the twist; clicks, hover, snaps, grips and wheel zoom go through `to_world`/`to_screen`. Grid lines and axes stay world-aligned; the selection window is drawn as the world box it selects. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>