Skip to content

Commit d8ec86f

Browse files
committed
bugfix
1 parent d7d697c commit d8ec86f

File tree

6 files changed

+25
-18
lines changed

6 files changed

+25
-18
lines changed

library.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,14 @@
1212
"url": "https://github.com/lovyan03/M5Stack_TreeView"
1313
},
1414
"dependencies": {
15-
"name": "M5Stack"
15+
{
16+
"name": "M5Stack"
17+
},
18+
{
19+
"name": "M5Stack_OnScreenKeyboard"
20+
}
1621
},
17-
"version": "0.2.12",
22+
"version": "0.2.13",
1823
"framework": "arduino",
1924
"platforms": "espressif32",
2025
"build": {

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=M5Stack_TreeView
2-
version=0.2.12
2+
version=0.2.13
33
author=lovyan03
44
maintainer=Lovyan <[email protected]>
55
sentence=TreeView Menu UI for M5Stack

src/MenuItem.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,12 @@ MenuItem* MenuItem::draw(bool force, const Rect16* cursorRect, const Rect16* old
280280
}
281281

282282
if (_parentItem && _parentItem->rect.intersectsWith(rect)) {
283-
if (_parentItem && _parentItem->rect.right() > rtmp.x) {
283+
if (0 < rtmp.h && _parentItem && _parentItem->rect.right() > rtmp.x) {
284284
Rect16 r = rtmp;
285285
r.w -= _parentItem->rect.right() - r.x;
286286
r.x = _parentItem->rect.right();
287-
M5.Lcd.fillRect(r.x, r.y, r.w, r.h, backColor[0]);
287+
if (r.w > 0)
288+
M5.Lcd.fillRect(r.x, r.y, r.w, r.h, backColor[0]);
288289
}
289290

290291
if (_parentItem && _parentItem->rect.bottom() > rtmp.y) {
@@ -300,15 +301,16 @@ MenuItem* MenuItem::draw(bool force, const Rect16* cursorRect, const Rect16* old
300301
if (0 < rtmp.h && 0 < rtmp.w) {
301302
bool cursor = cursorRect && cursorRect->intersectsWith(rtmp);
302303
// fill item body
303-
if (cursor) {
304+
if (cursor) {
304305
Rect16 r = rtmp.intersect(*cursorRect);
305-
if (0 < r.h) { // fill cursor color
306-
M5.Lcd.fillRect(rtmp.x, r.y, rtmp.w, r.h, backColor[1]);
307-
}
308-
if (cursorRect->y < rtmp.y) {
309-
M5.Lcd.fillRect(rtmp.x, r.bottom(), rtmp.w, rtmp.bottom() - cursorRect->bottom(), backColor[0]);
310-
} else if (cursorRect->y > rtmp.y) {
311-
M5.Lcd.fillRect(rtmp.x, rtmp.y, rtmp.w, cursorRect->y - rtmp.y, backColor[0]);
306+
if (0 < r.h) {
307+
if (rtmp.y < r.y) {
308+
M5.Lcd.fillRect(rtmp.x, rtmp.y, rtmp.w, r.y - rtmp.y , backColor[0]);
309+
}
310+
if (rtmp.bottom() > r.bottom()) {
311+
M5.Lcd.fillRect(rtmp.x, r.bottom(), rtmp.w, rtmp.bottom() - r.bottom(), backColor[0]);
312+
}
313+
M5.Lcd.fillRect(rtmp.x, r.y, rtmp.w, r.h, backColor[1]); // fill cursor color
312314
}
313315
} else {
314316
M5.Lcd.fillRect(rtmp.x, rtmp.y, rtmp.w, rtmp.h, backColor[0]);

src/MenuItemSD.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ MenuItemFS* MenuItemSD::newMenuItemFS(const String& title, const String& path, b
99
fs::FS& MenuItemSD::getFS() const {
1010
if (0 == path.length()) {
1111
SD.end();
12-
SD.begin( TFCARD_CS_PIN, SPI, 40000000);
12+
SD.begin( TFCARD_CS_PIN, SPI, 20000000);
1313
}
1414
return SD;
1515
}

src/MenuItemSD.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ class MenuItemSD : public MenuItemFS
1717

1818

1919
protected:
20-
virtual MenuItemFS* newMenuItemFS(const String& title, const String& path, bool isdir) const;
21-
virtual fs::FS& getFS() const;
20+
MenuItemFS* newMenuItemFS(const String& title, const String& path, bool isdir) const override;
21+
fs::FS& getFS() const override;
2222
};
2323

2424
#endif

src/MenuItemSPIFFS.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ class MenuItemSPIFFS : public MenuItemFS
1717

1818

1919
protected:
20-
virtual MenuItemFS* newMenuItemFS(const String& title, const String& path, bool isdir) const;
21-
virtual fs::FS& getFS() const;
20+
MenuItemFS* newMenuItemFS(const String& title, const String& path, bool isdir) const override;
21+
fs::FS& getFS() const override;
2222
};
2323

2424
#endif

0 commit comments

Comments
 (0)