File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
internal_filesystem/apps/com.example.draw/assets Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ def get_xy():
8888 else :
8989 return indev_error_x ,indev_error_y # make it visible that this occurred
9090
91+ # doesnt work:
9192def draw_line (x , y ):
9293 global canvas
9394 # Line drawing like this doesn't work:
@@ -145,7 +146,11 @@ def touch_cb(event):
145146 for dx in range (- radius , radius ):
146147 for dy in range (- radius , radius ):
147148 if dx * dx + dy * dy <= square :
148- canvas .set_px (x + dx , y + dy , DARKPINK , lv .OPA .COVER )
149+ newx , newy = x + dx , y + dy
150+ if 0 <= newx <= hor_res and 0 <= newy <= ver_res :
151+ canvas .set_px (x + dx , y + dy , DARKPINK , lv .OPA .COVER )
152+ else :
153+ print (f"Not drawing outside of canvas at { newx } ,{ newy } because that crashes." )
149154
150155
151156canvas = lv .canvas (appscreen )
You can’t perform that action at this time.
0 commit comments