mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-24 09:46:59 -06:00
Fix #39: rotated objects keep their angle and a rotated bounding box
Rotating an object baked the rotation into its geometry and kept nothing
else, so the bounding box, the handles and the Transform/Properties
panels fell back to the page-aligned box (the Rotate field went back to 0).
Root cause: nodes carried no record of their own axes. Each node now
keeps `bbox_angle` (append-only, written only when non-zero), which every
transform turns with the object (mirroring transforms keep the nearer of
the two possible boxes). The geometry is still baked. The selection's box
(`Document::oriented_bounds`) stands at the angle the selected objects
share. The Selection tool hit-tests and scales its handles in that frame,
and the canvas draws it rotated. `object.setBounds` measures W/H and the
reference point along it. `object.rotate {absolute}` turns the selection
to an angle, which the panels' Rotate field now shows and sets. Object >
Transform > Reset Bounding Box (previously a no-op) clears the angle in
one undo step.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d3d6cce917
commit
96604acffb
+14
@@ -1640,3 +1640,17 @@ CMYK one. Settings saved before these options load with their defaults.
|
||||
```json
|
||||
{"name":"run_command","arguments":{"command":"file.print","params":{"path":"/tmp/proof.pdf","settings":{"advanced":{"overprints":"simulate","flattenerPreset":"High Resolution"},"color":{"profile":"VectorCraft Generic CMYK (SWOP-like)","intent":"perceptual"}}}}}
|
||||
```
|
||||
|
||||
### Rotated bounding boxes
|
||||
|
||||
Every object keeps the angle of its own axes (counter-clockwise degrees; `document.inspect` reports it as a node's
|
||||
`rotation`, and the selection's shared angle as `selectionRotation`, 0 when the selected objects differ). Transforms
|
||||
turn it with the object while its path geometry is still baked, so after a rotation the bounding box and its handles
|
||||
stay square to it, as in the reference app. `object.rotate {angle, absolute: true}` turns the selection to an angle
|
||||
(the Transform and Properties panels' Rotate field), and `object.setBounds` measures width, height and the reference
|
||||
point along the turned box (x, y stay page coordinates). Objects turned together share the box. A new group starts
|
||||
square to the page. `object.resetBoundingBox` squares the box again without moving the art.
|
||||
|
||||
```json
|
||||
{"name":"run_command","arguments":{"command":"object.rotate","params":{"angle":45,"absolute":true}}}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user