File tree Expand file tree Collapse file tree 2 files changed +14
-10
lines changed
examples/colorTftEthernet32 Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change 11{
22 "lastEdited": {
3- "seconds": 1585206207 ,
3+ "seconds": 1585206986 ,
44 "nanos": 0
55 },
66 "codeOptions": {
Original file line number Diff line number Diff line change @@ -179,10 +179,11 @@ void AdaFruitGfxMenuRenderer::render() {
179179 if (lastOffset != toOffsetBy) locRedrawMode = MENUDRAW_COMPLETE_REDRAW;
180180 lastOffset = toOffsetBy;
181181
182- while (item != NULL && toOffsetBy--) {
183- item = item->getNext ();
184- }
185- }
182+ while (item != NULL && toOffsetBy) {
183+ if (item->isVisible ()) toOffsetBy = toOffsetBy - 1 ;
184+ item = item->getNext ();
185+ }
186+ }
186187 else {
187188 if (lastOffset != 0xff ) locRedrawMode = MENUDRAW_COMPLETE_REDRAW;
188189 lastOffset = 0xff ;
@@ -191,14 +192,17 @@ void AdaFruitGfxMenuRenderer::render() {
191192 // and then we start drawing items until we run out of screen or items
192193 int ypos = titleHeight;
193194 while (item && (ypos + itemHeight) <= graphics->height () ) {
194- if (locRedrawMode != MENUDRAW_NO_CHANGE || item->isChanged ()) {
195- requiresUpdate = true ;
195+ if (item->isVisible ())
196+ {
197+ if (locRedrawMode != MENUDRAW_NO_CHANGE || item->isChanged ()) {
198+ requiresUpdate = true ;
196199
197- taskManager.yieldForMicros (0 );
200+ taskManager.yieldForMicros (0 );
198201
199- renderMenuItem (ypos, itemHeight, item);
202+ renderMenuItem (ypos, itemHeight, item);
203+ }
204+ ypos += itemHeight;
200205 }
201- ypos += itemHeight;
202206 item = item->getNext ();
203207 }
204208 }
You can’t perform that action at this time.
0 commit comments