mirror of
https://github.com/penpot/penpot.git
synced 2025-05-23 02:06:11 +02:00
🎉 Avoid rendering too small shapes
This commit is contained in:
parent
d1d30e7eb5
commit
a80f114d66
2 changed files with 9 additions and 1 deletions
|
@ -42,6 +42,8 @@ pub use transform::*;
|
|||
use crate::math;
|
||||
use crate::math::{Bounds, Matrix, Point};
|
||||
|
||||
const MIN_VISIBLE_SIZE: f32 = 2.0;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Type {
|
||||
Frame(Frame),
|
||||
|
@ -505,6 +507,11 @@ impl Shape {
|
|||
self.hidden
|
||||
}
|
||||
|
||||
pub fn visually_insignificant(&self, scale: f32) -> bool {
|
||||
self.selrect.width() * scale < MIN_VISIBLE_SIZE
|
||||
|| self.selrect.height() * scale < MIN_VISIBLE_SIZE
|
||||
}
|
||||
|
||||
// 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