@@ -212,31 +212,50 @@ static bool bmp_editor_select_size_input_callback(InputEvent* input_event, void*
212
212
static bool bmp_editor_draw_input_callback (InputEvent * input_event , void * ctx ) {
213
213
AppContext * app = (AppContext * )ctx ;
214
214
AppBmpEditor * BmpEditor = app -> sceneBmpEditor ;
215
-
215
+ bmpEditorData * BmpEditorData = BmpEditor -> model_data ;
216
216
bool consumed = false;
217
217
BMP_err res = BMP_OK ;
218
- if ((input_event -> type == InputTypePress ) || (input_event -> type == InputTypeRepeat )) {
218
+ if ((input_event -> type == InputTypePress ) || (input_event -> type == InputTypeRepeat ) ||
219
+ (input_event -> type == InputTypeLong )) {
219
220
switch (input_event -> key ) {
220
221
case InputKeyUp :
221
222
bmp_editor_move (BmpEditor , 0 , -1 );
223
+ if (BmpEditorData -> draw_mode == BmpEditorDrawModeContinuous ) {
224
+ bmp_editor_toggle (BmpEditor );
225
+ }
222
226
consumed = true;
223
227
break ;
224
228
case InputKeyDown :
225
229
bmp_editor_move (BmpEditor , 0 , 1 );
230
+ if (BmpEditorData -> draw_mode == BmpEditorDrawModeContinuous ) {
231
+ bmp_editor_toggle (BmpEditor );
232
+ }
226
233
consumed = true;
227
234
break ;
228
235
case InputKeyLeft :
229
236
bmp_editor_move (BmpEditor , -1 , 0 );
230
- bmp_compute_model (BmpEditor , BmpEditor -> model_data );
237
+ if (BmpEditorData -> draw_mode == BmpEditorDrawModeContinuous ) {
238
+ bmp_editor_toggle (BmpEditor );
239
+ }
231
240
consumed = true;
232
241
break ;
233
242
case InputKeyRight :
234
243
bmp_editor_move (BmpEditor , 1 , 0 );
235
- bmp_compute_model (BmpEditor , BmpEditor -> model_data );
244
+ if (BmpEditorData -> draw_mode == BmpEditorDrawModeContinuous ) {
245
+ bmp_editor_toggle (BmpEditor );
246
+ }
236
247
consumed = true;
237
248
break ;
238
249
case InputKeyOk :
239
- bmp_editor_toggle (BmpEditor );
250
+ if (input_event -> type == InputTypeLong ) {
251
+ BmpEditorData -> draw_mode = (BmpEditorData -> draw_mode == BmpEditorDrawModeOneshot ) ?
252
+ BmpEditorDrawModeContinuous :
253
+ BmpEditorDrawModeOneshot ;
254
+ } else {
255
+ if (BmpEditorData -> draw_mode == BmpEditorDrawModeOneshot ) {
256
+ bmp_editor_toggle (BmpEditor );
257
+ }
258
+ }
240
259
consumed = false;
241
260
break ;
242
261
case InputKeyBack :
@@ -361,8 +380,12 @@ static void bmp_editor_drawBoard(Canvas* canvas, void* ctx) {
361
380
canvas_draw_str (canvas , 25 + 10 , 62 , "Save" );
362
381
canvas_draw_icon (canvas , 25 + 35 , 56 , & I_btn_ok_7x7 );
363
382
canvas_draw_str (canvas , 25 + 45 , 62 , "Toggle" );
364
-
383
+ // Indicates continuous mode
365
384
canvas_set_font (canvas , FontPrimary );
385
+ if (BmpEditorData -> draw_mode == BmpEditorDrawModeContinuous ) {
386
+ canvas_draw_str (canvas , 0 , 62 , "C" );
387
+ ;
388
+ }
366
389
// Bitmap
367
390
for (x = 0 ; x < BmpEditorData -> bmp_w ; x ++ ) {
368
391
for (y = 0 ; y < BmpEditorData -> bmp_h ; y ++ ) {
0 commit comments