mirror of
https://github.com/penpot/penpot.git
synced 2025-05-23 11:16:11 +02:00
🎉 Disable antialias for small shapes
This commit is contained in:
parent
a80f114d66
commit
85b24e1e8d
8 changed files with 119 additions and 64 deletions
|
@ -43,6 +43,7 @@ use crate::math;
|
|||
use crate::math::{Bounds, Matrix, Point};
|
||||
|
||||
const MIN_VISIBLE_SIZE: f32 = 2.0;
|
||||
const ANTIALIAS_THRESHOLD: f32 = 15.0;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Type {
|
||||
|
@ -512,6 +513,11 @@ impl Shape {
|
|||
|| self.selrect.height() * scale < MIN_VISIBLE_SIZE
|
||||
}
|
||||
|
||||
pub fn should_use_antialias(&self, scale: f32) -> bool {
|
||||
self.selrect.width() * scale > ANTIALIAS_THRESHOLD
|
||||
|| self.selrect.height() * scale > ANTIALIAS_THRESHOLD
|
||||
}
|
||||
|
||||
// TODO: Maybe store this inside the shape
|
||||
pub fn bounds(&self) -> Bounds {
|
||||
let mut bounds = Bounds::new(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue