mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-24 10:58:12 +08:00
Add a 'Preserve Aspect Ratio' checkbox to Properties panel (#923)
* Add the link button * Transform around pivot * Remove log * Fix tests * Add a hacky two-line layout for the checkbox Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
committed by
Keavon Chambers
co-authored by
Keavon Chambers
parent
df74f6f562
commit
904f38fa1b
@@ -227,6 +227,9 @@ pub struct Layer {
|
||||
/// A transformation applied to the layer (translation, rotation, scaling, and shear).
|
||||
#[serde(with = "DAffine2Ref")]
|
||||
pub transform: glam::DAffine2,
|
||||
/// Should the aspect ratio of this layer be preserved?
|
||||
#[serde(default = "return_true")]
|
||||
pub preserve_aspect: bool,
|
||||
/// The center of transformations like rotation or scaling with the shift key.
|
||||
/// This is in local space (so the layer's transform should be applied).
|
||||
pub pivot: DVec2,
|
||||
@@ -255,6 +258,7 @@ impl Layer {
|
||||
name: None,
|
||||
data,
|
||||
transform: glam::DAffine2::from_cols_array(&transform),
|
||||
preserve_aspect: true,
|
||||
pivot: DVec2::splat(0.5),
|
||||
cache: String::new(),
|
||||
thumbnail_cache: String::new(),
|
||||
@@ -515,6 +519,7 @@ impl Clone for Layer {
|
||||
name: self.name.clone(),
|
||||
data: self.data.clone(),
|
||||
transform: self.transform,
|
||||
preserve_aspect: self.preserve_aspect,
|
||||
pivot: self.pivot,
|
||||
cache: String::new(),
|
||||
thumbnail_cache: String::new(),
|
||||
|
||||
Reference in New Issue
Block a user