From fdca2b92208448e36c22f5ec712f0c1737cc96c0 Mon Sep 17 00:00:00 2001 From: Konkitoman Date: Sun, 23 Jul 2023 14:32:54 +0300 Subject: [PATCH] Now painter is not affected by the current_viewport --- crates/egui/src/painter.rs | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/crates/egui/src/painter.rs b/crates/egui/src/painter.rs index 06bb1d9d6..214bbe175 100644 --- a/crates/egui/src/painter.rs +++ b/crates/egui/src/painter.rs @@ -168,10 +168,6 @@ impl Painter { /// Can be used for free painting. /// NOTE: all coordinates are screen coordinates! pub fn add(&self, shape: impl Into) -> ShapeIdx { - if self.ctx.current_viewport() != self.ctx.current_rendering_viewport() { - return self - .paint_list(|l| l.add(Rect::from_min_size(Pos2::ZERO, Vec2::ZERO), Shape::Noop)); - } if self.fade_to_color == Some(Color32::TRANSPARENT) { self.paint_list(|l| l.add(self.clip_rect, Shape::Noop)) } else { @@ -185,9 +181,7 @@ impl Painter { /// /// Calling this once is generally faster than calling [`Self::add`] multiple times. pub fn extend>(&self, shapes: I) { - if self.fade_to_color == Some(Color32::TRANSPARENT) - || self.ctx.current_viewport() != self.ctx.current_rendering_viewport() - { + if self.fade_to_color == Some(Color32::TRANSPARENT) { return; } if self.fade_to_color.is_some() { @@ -203,9 +197,7 @@ impl Painter { /// Modify an existing [`Shape`]. pub fn set(&self, idx: ShapeIdx, shape: impl Into) { - if self.fade_to_color == Some(Color32::TRANSPARENT) - || self.ctx.current_viewport() != self.ctx.current_rendering_viewport() - { + if self.fade_to_color == Some(Color32::TRANSPARENT) { return; } let mut shape = shape.into(); @@ -398,9 +390,6 @@ impl Painter { font_id: FontId, text_color: Color32, ) -> Rect { - if self.ctx.current_viewport() != self.ctx.current_rendering_viewport() { - return Rect::from_min_size(Pos2::ZERO, Vec2::ZERO); - } let galley = self.layout_no_wrap(text.to_string(), font_id, text_color); let rect = anchor.anchor_rect(Rect::from_min_size(pos, galley.size())); self.galley(rect.min, galley);