Skip to content

Commit

Permalink
消しゴムの誤動作の修正
Browse files Browse the repository at this point in the history
消しゴムによって外枠が消えてしまう誤動作を修正しました。
また、e_ratoをe_ratioに修正しました。
  • Loading branch information
s-moa authored Nov 21, 2021
1 parent 6d9add7 commit 68fa00c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions poketch/draw.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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_
#endif // _DG_DRAW_

0 comments on commit 68fa00c

Please sign in to comment.