fix(color): don't enlarge image in the file preview window (#4943)

This commit is contained in:
philmoz
2024-05-01 09:57:47 +10:00
committed by GitHub
parent 4f0610c551
commit 796886772e
3 changed files with 5 additions and 1 deletions
+1
View File
@@ -25,6 +25,7 @@ FilePreview::FilePreview(Window *parent, const rect_t &rect) :
StaticImage(parent, rect)
{
hide();
dontEnlarge = true;
}
void FilePreview::setFile(const char *filename)
+3 -1
View File
@@ -235,7 +235,9 @@ void StaticImage::setZoom()
if (img && img->w && img->h) {
uint16_t zw = (width() * 256) / img->w;
uint16_t zh = (height() * 256) / img->h;
lv_img_set_zoom(image, min(zw, zh));
uint16_t z = min(zw, zh);
if (dontEnlarge) z = min(z, (uint16_t)256);
lv_img_set_zoom(image, z);
}
}
+1
View File
@@ -154,6 +154,7 @@ class StaticImage : public Window
bool hasImage() const;
protected:
bool dontEnlarge = false;
lv_obj_t *image = nullptr;
};