mirror of
https://github.com/storytold/photocraft.git
synced 2026-10-26 02:47:07 -06:00
* feat(engine): accept Photoshop units for guide positions view.newGuide and view.moveGuide take the position as before (a number of pixels) or as text with a unit, as Photoshop's New Guide dialog does: "50%", "2.5 cm", "1in", "12pt", "3pc", "100px". Percent is of the document's width for a vertical guide and its height for a horizontal one; points and picas follow Units & Rulers › Point Size. Fractional positions are kept. Text that isn't a length, NaN and positions beyond 1,000,000 px are refused without recording a history step. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(engine): guides can have their own colour Photoshop's New Guide sets a colour per guide; PhotoCraft guides only had the Preferences guide colour. Guides now keep optional colours, keyed by orientation and position so code that drops or reorders guide positions (crop, artboards, guide layouts) can never move a colour onto another guide: an unmatched guide just uses the preference colour. view.newGuide takes an optional "color": a name from New Guide's list (lightBlue, lightRed, green, mediumBlue, yellow, magenta, cyan, lightGray, black) or "#rrggbb". Without one the guide uses the preference colour, as guides dragged from the rulers always have. Moving a guide carries its colour; deleting and clearing drop it (Clear Guides, Clear Canvas Guides, Clear Selected Artboard Guides and New Guide Layout's Clear Existing Guides alike); undo restores it. Guides are drawn in their own colour (while New Guide Layout previews, the rest show the colour it will set), and .pcraft files keep it (omitted when no guide has one, so older readers and files are unaffected). PSD export keeps guide positions only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(ui): Photoshop's New Guide dialog: units and colour View › Guides › New Guide… was the generic schema dialog, whose position field was whole pixels only and had no colour. It now has its own dialog, as in Photoshop: - Position opens in the ruler unit ("0 cm") and takes any unit Photoshop's field takes ("50%", "2.5 cm", "12 pt"); a bare number is in the ruler unit. The last guide reopens in whatever the ruler unit is then ("5.08 cm"). - Color lists Custom…, Light Blue, Light Red, Green, Medium Blue, Yellow, Magenta, Cyan (the default), Light Gray and Black. Custom… shows a swatch that opens the Color Picker. The guide stores the chosen colour itself, so a later change of the preference guide colour leaves it alone. - A position the engine refuses reopens the dialog with what was typed and the engine's message, as Photoshop keeps New Guide open. Light Blue, Light Red, Medium Blue and Light Gray are new to the catalogues; they were translated for all 16 languages from the existing colour terms in each and would benefit from native review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor(engine): one unit-suffix table for typed lengths New Guide's position field (Unit::parse_length) and the Crop tool's size fields (crop_size::unit_of) each kept the same table of unit suffixes. Unit::from_suffix is now the one table: px, in or ", cm, mm, pt, pc or pica, % and their long forms, in any case. The crop fields keep their own number parsing (they accept arithmetic) and still refuse percent; they now also accept "pc" for picas. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(ui): New Guide and New Guide Layout share one colour list New Guide Layout (#2930) offered five colours of its own; New Guide offers Photoshop's nine. Both dialogs now list the same nine (GUIDE_COLORS), in Photoshop's order and with the same translated names. Cyan (#4affff, the default guide colour), Magenta (#ff00ff) and Yellow (#ffcc00) take New Guide Layout's values; Light Blue, Light Red, Green, Medium Blue, Light Gray and Black keep New Guide's. New Guide Layout's Blue (#378ef0) and jade Green (#00a86b) give way to Photoshop's Light Blue and Green; a colour outside the list still shows as Custom. GUIDE_COLORS drops its unused label column (the dialogs translate the names), and New Guide Layout reads "#rrggbb" with prefs::parse_hex instead of its own copy (rulers::parse_guide_color). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>