@@ -353,21 +353,38 @@ static void compute_position(nbgl_obj_t *obj, nbgl_obj_t *prevObj)
353
353
354
354
obj -> area .x0 = parent -> obj .area .x0 + obj -> rel_x0 ;
355
355
obj -> area .y0 = parent -> obj .area .y0 + obj -> rel_y0 ;
356
-
357
- if ((obj -> area .x0 + obj -> area .width ) > SCREEN_WIDTH ) {
356
+ if ((obj -> area .x0 + obj -> area .width ) > (parent -> obj .area .x0 + parent -> obj .area .width )) {
357
+ #ifdef BUILD_SCREENSHOTS
358
+ obj -> area .width = parent -> obj .area .x0 + parent -> obj .area .width - obj -> area .x0 ;
359
+ // Be sure the area is not empty
360
+ if (!obj -> area .width ) {
361
+ obj -> area .width = 1 ;
362
+ obj -> area .x0 -= 1 ;
363
+ }
364
+ #else // BUILD_SCREENSHOTS
358
365
LOG_FATAL (OBJ_LOGGER ,
359
366
"compute_position(), forbidden width, obj->type = %d, x0=%d, width=%d\n" ,
360
367
obj -> type ,
361
368
obj -> area .x0 ,
362
369
obj -> area .width );
370
+ #endif // BUILD_SCREENSHOTS
363
371
}
364
372
#ifdef HAVE_SE_TOUCH
365
- if ((obj -> area .y0 + obj -> area .height ) > SCREEN_HEIGHT ) {
373
+ if ((obj -> area .y0 + obj -> area .height ) > (parent -> obj .area .y0 + parent -> obj .area .height )) {
374
+ #ifdef BUILD_SCREENSHOTS
375
+ obj -> area .height = parent -> obj .area .y0 + parent -> obj .area .height - obj -> area .y0 ;
376
+ // Be sure the area is not empty
377
+ if (!obj -> area .height ) {
378
+ obj -> area .height = 1 ;
379
+ obj -> area .y0 -= 1 ;
380
+ }
381
+ #else // BUILD_SCREENSHOTS
366
382
LOG_FATAL (OBJ_LOGGER ,
367
383
"compute_position(), forbidden height, obj->type = %d, y0=%d, height=%d\n" ,
368
384
obj -> type ,
369
385
obj -> area .y0 ,
370
386
obj -> area .height );
387
+ #endif // BUILD_SCREENSHOTS
371
388
}
372
389
#endif // HAVE_SE_TOUCH
373
390
}
0 commit comments