mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-29 12:17:14 -06:00
M3.72: Tile Edge Color dialog and Show Swatch Bounds in pattern editing
Object > Pattern > Tile Edge Color... picks the colour of the tile edge
(a layer-colour preset or a custom colour), stored in the preference
patternTileEdgeColor and passed to the renderer. Pattern Options gains
Show Swatch Bounds: a dashed outline of the part of the tiling the swatch
repeats (the period of brick and hex tilings).
Commands: prefs.set {patternTileEdgeColor}, pattern.options
{showSwatchBounds}, ui.tileEdgeColor. Model: PatternDef.show_swatch_bounds.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d8b942c43d
commit
b36fd67bf4
@@ -182,6 +182,10 @@ pub struct PatternDef {
|
||||
pub dim_copies: f32,
|
||||
#[serde(default = "yes")]
|
||||
pub show_tile_edge: bool,
|
||||
/// Show Swatch Bounds: pattern editing mode outlines the part of the tiling the swatch repeats
|
||||
/// (the tile, or the period of a brick or hex tiling), dashed.
|
||||
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
||||
pub show_swatch_bounds: bool,
|
||||
}
|
||||
|
||||
impl PatternDef {
|
||||
@@ -200,6 +204,7 @@ impl PatternDef {
|
||||
copies: 5,
|
||||
dim_copies: 70.0,
|
||||
show_tile_edge: true,
|
||||
show_swatch_bounds: false,
|
||||
}
|
||||
}
|
||||
pub fn width(&self) -> f64 {
|
||||
@@ -226,6 +231,11 @@ impl PatternDef {
|
||||
pub fn period(&self) -> (f64, f64) {
|
||||
tile_period(self.tile_type, self.width(), self.height())
|
||||
}
|
||||
/// The swatch bounds (Show Swatch Bounds): the period of the tiling from the tile's origin.
|
||||
pub fn swatch_bounds(&self) -> Rect {
|
||||
let (w, h) = self.period();
|
||||
Rect::from_origin_size(self.tile.origin(), (w, h))
|
||||
}
|
||||
/// Maps the art's coordinates into pattern space for instance offset `o`.
|
||||
pub fn instance_xf(&self, o: Vec2) -> Affine {
|
||||
Affine::translate(o - self.tile.origin().to_vec2())
|
||||
|
||||
Reference in New Issue
Block a user