mirror of
https://github.com/penpot/penpot.git
synced 2026-10-29 05:50:35 +00:00
🐛 Clear doc atlas when canvas background color changes (#12112)
This commit is contained in:
parent
b41445d092
commit
70dfe90571
@ -986,7 +986,12 @@ impl RenderState {
|
||||
}
|
||||
|
||||
pub fn set_background_color(&mut self, color: skia::Color) {
|
||||
if self.background_color == color {
|
||||
return;
|
||||
}
|
||||
self.background_color = color;
|
||||
// Tiles bake the background in; old atlas pixels would show on pan/zoom.
|
||||
self.surfaces.atlas.clear();
|
||||
}
|
||||
|
||||
pub fn set_preview_mode(&mut self, enabled: bool) {
|
||||
|
||||
@ -185,6 +185,12 @@ impl DocAtlas {
|
||||
self.size.width <= 0 || self.size.height <= 0
|
||||
}
|
||||
|
||||
/// Drops all atlas content while keeping its allocation and placement.
|
||||
pub fn clear(&mut self) {
|
||||
self.surface.canvas().clear(skia::Color::TRANSPARENT);
|
||||
self.tile_doc_rects.clear();
|
||||
}
|
||||
|
||||
/// Sets the document-space bounds used to clamp atlas updates.
|
||||
/// Pass `None` to disable clamping.
|
||||
pub fn set_doc_bounds(&mut self, bounds: Option<skia::Rect>) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user