Skip to content

Commit 68fa00c

Browse files
authored
消しゴムの誤動作の修正
消しゴムによって外枠が消えてしまう誤動作を修正しました。 また、e_ratoをe_ratioに修正しました。
1 parent 6d9add7 commit 68fa00c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

poketch/draw.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Draw
2020
const int16_t _pen_out = 12;
2121

2222
const int16_t dot = 4;
23-
const int16_t e_rato = 3;
23+
const int16_t e_ratio = 3;
2424

2525
LGFX_Sprite sprite_pen;
2626
LGFX_Sprite sprite_eraser;
@@ -273,10 +273,12 @@ void Draw::drawDot(int16_t x, int16_t y)
273273
else
274274
{
275275
// 消しゴム
276-
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);
276+
int16_t x_eraser = floor(x / (dot * e_ratio)) * dot * e_ratio;
277+
int16_t y_eraser = floor(y / (dot * e_ratio)) * dot * e_ratio;
278+
lcd.fillRect(x_eraser, y_eraser, std::min(dot * e_ratio, WINDOW_WIDTH - TAB_WIDTH - x_eraser), dot * e_ratio, POK_WHITE);
277279
}
278280
}
279281
Serial.println("drawDot");
280282
}
281283

282-
#endif // _DG_DRAW_
284+
#endif // _DG_DRAW_

0 commit comments

Comments
 (0)