mirror of
https://github.com/penpot/penpot.git
synced 2025-05-23 05:26:11 +02:00
🐛 Fix path rotation
This commit is contained in:
parent
d4b829ed19
commit
e1c5cd6640
4 changed files with 110 additions and 76 deletions
|
@ -2,7 +2,7 @@ use crate::math;
|
|||
use skia_safe as skia;
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::render::BlendMode;
|
||||
use crate::render::{BlendMode, Renderable};
|
||||
|
||||
mod fills;
|
||||
mod images;
|
||||
|
@ -138,6 +138,21 @@ impl Shape {
|
|||
pub fn set_blend_mode(&mut self, mode: BlendMode) {
|
||||
self.blend_mode = mode;
|
||||
}
|
||||
|
||||
fn to_path_transform(&self) -> Option<skia::Matrix> {
|
||||
match self.kind {
|
||||
Kind::Path(_) => {
|
||||
let center = self.bounds().center();
|
||||
let mut matrix = skia::Matrix::new_identity();
|
||||
matrix.pre_translate(center);
|
||||
matrix.pre_concat(&self.transform.no_translation().to_skia_matrix().invert()?);
|
||||
matrix.pre_translate(-center);
|
||||
|
||||
Some(matrix)
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue