Skip to content

Commit

Permalink
Remove extra request_paint calls
Browse files Browse the repository at this point in the history
  • Loading branch information
PoignardAzur committed Aug 24, 2024
1 parent d07ef94 commit d763708
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 12 deletions.
1 change: 0 additions & 1 deletion masonry/src/widget/label.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ impl WidgetMut<'_, Label> {
let ret = f(&mut self.widget.text_layout);
if self.widget.text_layout.needs_rebuild() {
self.ctx.request_layout();
self.ctx.request_paint();
}
ret
}
Expand Down
3 changes: 0 additions & 3 deletions masonry/src/widget/prose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ impl Widget for Prose {
let made_change = self.text_layout.pointer_down(inner_origin, state, *button);
if made_change {
ctx.request_layout();
ctx.request_paint();
ctx.request_focus();
ctx.set_active(true);
}
Expand All @@ -165,7 +164,6 @@ impl Widget for Prose {
if ctx.is_active() && self.text_layout.pointer_move(inner_origin, state) {
// We might have changed text colours, so we need to re-request a layout
ctx.request_layout();
ctx.request_paint();
}
}
}
Expand All @@ -190,7 +188,6 @@ impl Widget for Prose {
ctx.set_handled();
// TODO: only some handlers need this repaint
ctx.request_layout();
ctx.request_paint();
}
}

Expand Down
3 changes: 0 additions & 3 deletions masonry/src/widget/textbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ impl Widget for Textbox {
let made_change = self.editor.pointer_down(inner_origin, state, *button);
if made_change {
ctx.request_layout();
ctx.request_paint();
ctx.request_focus();
ctx.set_active(true);
}
Expand All @@ -186,7 +185,6 @@ impl Widget for Textbox {
{
// We might have changed text colours, so we need to re-request a layout
ctx.request_layout();
ctx.request_paint();
}
}
PointerEvent::PointerUp(button, state) => {
Expand All @@ -210,7 +208,6 @@ impl Widget for Textbox {
ctx.set_handled();
// TODO: only some handlers need this repaint
ctx.request_layout();
ctx.request_paint();
}
}

Expand Down
6 changes: 1 addition & 5 deletions masonry/src/widget/variable_label.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ impl WidgetMut<'_, VariableLabel> {
let ret = f(&mut self.widget.text_layout);
if self.widget.text_layout.needs_rebuild() {
self.ctx.request_layout();
self.ctx.request_paint();
}
ret
}
Expand All @@ -247,7 +246,6 @@ impl WidgetMut<'_, VariableLabel> {
if !self.ctx.is_disabled() {
self.widget.text_layout.invalidate();
self.ctx.request_layout();
self.ctx.request_paint();
}
}
/// Set the font size for this text.
Expand All @@ -269,13 +267,12 @@ impl WidgetMut<'_, VariableLabel> {
/// How to handle overflowing lines.
pub fn set_line_break_mode(&mut self, line_break_mode: LineBreaking) {
self.widget.line_break_mode = line_break_mode;
self.ctx.request_paint();
self.ctx.request_layout();
}
/// Set the weight which this font will target.
pub fn set_target_weight(&mut self, target: f32, over_millis: f32) {
self.widget.weight.move_to(target, over_millis);
self.ctx.request_layout();
self.ctx.request_paint();
self.ctx.request_anim_frame();
}
}
Expand Down Expand Up @@ -343,7 +340,6 @@ impl Widget for VariableLabel {
ctx.request_anim_frame();
}
ctx.request_layout();
ctx.request_paint();
}
_ => {}
}
Expand Down

0 comments on commit d763708

Please sign in to comment.