Skip to content

Commit d56c5d1

Browse files
committed
update move_rect Fn
1 parent cd2e230 commit d56c5d1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

os/src/gui/paint.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,14 @@ impl DrawingBoard {
2828
.draw(&mut self.graphics)
2929
.ok();
3030
}
31+
fn unpaint(&mut self) {
32+
Rectangle::with_center(self.latest_pos, Size::new(RECT_SIZE, RECT_SIZE))
33+
.into_styled(PrimitiveStyle::with_stroke(Rgb888::BLACK, 1))
34+
.draw(&mut self.graphics)
35+
.ok();
36+
}
3137
pub fn move_rect(&mut self, dx: i32, dy: i32) {
38+
self.unpaint();
3239
self.latest_pos.x += dx;
3340
self.latest_pos.y += dy;
3441
self.paint();

0 commit comments

Comments
 (0)