Skip to content

Commit

Permalink
Merge pull request #2 from s-moa/patch-2
Browse files Browse the repository at this point in the history
消しゴムの誤動作の修正
  • Loading branch information
toshi-pono authored Nov 22, 2021
2 parents a552589 + 68fa00c commit 1a2652b
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 1a2652b

Please sign in to comment.