From 68fa00c8057c898469fae2cde1dc0069e288d0ef Mon Sep 17 00:00:00 2001 From: Saisho Moa <90539399+s-moa@users.noreply.github.com> Date: Sun, 21 Nov 2021 22:10:28 +0900 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E3=81=97=E3=82=B4=E3=83=A0=E3=81=AE?= =?UTF-8?q?=E8=AA=A4=E5=8B=95=E4=BD=9C=E3=81=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 消しゴムによって外枠が消えてしまう誤動作を修正しました。 また、e_ratoをe_ratioに修正しました。 --- poketch/draw.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/poketch/draw.h b/poketch/draw.h index 429fbaa..9f27221 100644 --- a/poketch/draw.h +++ b/poketch/draw.h @@ -20,7 +20,7 @@ class Draw const int16_t _pen_out = 12; const int16_t dot = 4; - const int16_t e_rato = 3; + const int16_t e_ratio = 3; LGFX_Sprite sprite_pen; LGFX_Sprite sprite_eraser; @@ -273,10 +273,12 @@ void Draw::drawDot(int16_t x, int16_t y) else { // 消しゴム - lcd.fillRect(floor(x / (dot * e_rato)) * dot * e_rato, floor(y / (dot * e_rato)) * dot * e_rato, dot * e_rato, dot * e_rato, POK_WHITE); + int16_t x_eraser = floor(x / (dot * e_ratio)) * dot * e_ratio; + int16_t y_eraser = floor(y / (dot * e_ratio)) * dot * e_ratio; + lcd.fillRect(x_eraser, y_eraser, std::min(dot * e_ratio, WINDOW_WIDTH - TAB_WIDTH - x_eraser), dot * e_ratio, POK_WHITE); } } Serial.println("drawDot"); } -#endif // _DG_DRAW_ \ No newline at end of file +#endif // _DG_DRAW_