Fix layout mirror
This commit is contained in:
@@ -60,19 +60,16 @@ class Layout2P1: public Layout
|
||||
|
||||
rect_t getZone(unsigned int index) const override
|
||||
{
|
||||
if (isMirrored())
|
||||
index = 2 - index;
|
||||
|
||||
rect_t zone = getMainZone({border, border, LCD_W - 2 * border, LCD_H - 2 * border});
|
||||
|
||||
if (index == 0) {
|
||||
return {zone.x, zone.y,zone.w / 2, zone.h};
|
||||
return {isMirrored() ? zone.x : zone.x + zone.w / 2, zone.y,zone.w / 2, zone.h};
|
||||
}
|
||||
else if (index == 1) {
|
||||
return {zone.x + zone.w / 2, zone.y,zone.w / 2, zone.h / 2};
|
||||
return {isMirrored() ? zone.x + zone.w / 2 : zone.x, zone.y,zone.w / 2, zone.h / 2};
|
||||
}
|
||||
else {
|
||||
return {zone.x + zone.w / 2, zone.y + zone.h / 2,zone.w / 2, zone.h / 2};
|
||||
return {isMirrored() ? zone.x + zone.w / 2 : zone.x, zone.y + zone.h / 2,zone.w / 2, zone.h / 2};
|
||||
}
|
||||
|
||||
return zone;
|
||||
|
||||
@@ -60,16 +60,13 @@ class Layout2x1: public Layout
|
||||
|
||||
rect_t getZone(unsigned int index) const override
|
||||
{
|
||||
if (isMirrored())
|
||||
index = 1 - index;
|
||||
|
||||
rect_t zone = getMainZone({border, border, LCD_W - 2 * border, LCD_H - 2 * border});
|
||||
|
||||
if (index == 0) {
|
||||
return {zone.x, zone.y, zone.w / 2, zone.h};
|
||||
return {isMirrored() ? zone.x + zone.w / 2 : zone.x, zone.y, zone.w / 2, zone.h};
|
||||
}
|
||||
else {
|
||||
return {zone.x + zone.w / 2, zone.y, zone.w / 2, zone.h};
|
||||
return {isMirrored() ? zone.x : zone.x + zone.w / 2, zone.y, zone.w / 2, zone.h};
|
||||
}
|
||||
|
||||
return zone;
|
||||
|
||||
@@ -60,9 +60,6 @@ class Layout2x2: public Layout
|
||||
|
||||
rect_t getZone(unsigned int index) const override
|
||||
{
|
||||
if (isMirrored())
|
||||
index = 3 - index;
|
||||
|
||||
rect_t zone = getMainZone({border, border, LCD_W - 2 * border, LCD_H - 2 * border});
|
||||
|
||||
zone.w /= 2;
|
||||
@@ -71,7 +68,7 @@ class Layout2x2: public Layout
|
||||
if (index == 1 || index == 3)
|
||||
zone.y += zone.h;
|
||||
|
||||
if (index > 1)
|
||||
if ((!isMirrored() && index > 1)) || (isMirrored() && index < 2)
|
||||
zone.x += zone.w;
|
||||
|
||||
return zone;
|
||||
|
||||
@@ -63,16 +63,14 @@ class Layout2x4: public Layout
|
||||
|
||||
rect_t getZone(unsigned int index) const override
|
||||
{
|
||||
if (isMirrored())
|
||||
index = 7 - index;
|
||||
|
||||
rect_t zone = getMainZone({border, border, LCD_W - 2 * border, LCD_H - 2 * border});
|
||||
|
||||
zone.w /= 2;
|
||||
zone.h /= 4;
|
||||
|
||||
if (index > 3)
|
||||
if ((!isMirrored() && index > 3) || (isMirrored() && index < 4)) {
|
||||
zone.x += zone.w;
|
||||
}
|
||||
|
||||
zone.y += (index % 4) * zone.h;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user