Skip to content

Commit f83c9e2

Browse files
committed
#45 #46 providing support for visible flag on menu items, prepare for 1.4.0
1 parent 60829dd commit f83c9e2

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

examples/colorTftEthernet32/colorTftEthernet.emf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"lastEdited": {
3-
"seconds": 1585206207,
3+
"seconds": 1585206986,
44
"nanos": 0
55
},
66
"codeOptions": {

examples/colorTftEthernet32/tcMenuAdaFruitGfx.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)