Skip to content

Commit

Permalink
don't set zoom when loading from JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
freddyz committed Nov 11, 2019
1 parent 5074bef commit bfbc782
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/ComputerscareBlank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ struct PNGDisplay : TransparentWidget {
int imgWidth, imgHeight;
float imgRatio, widgetRatio;
int lastEnum = -1;
std::string path = "";
std::string path = "empty";
int img = 0;

PNGDisplay() {
Expand Down Expand Up @@ -190,16 +190,19 @@ struct PNGDisplay : TransparentWidget {
img = nvgCreateImage(args.vg, blankModule->path.c_str(), 0);
nvgImageSize(args.vg, img, &imgWidth, &imgHeight);
imgRatio = ((float)imgWidth / (float)imgHeight);

if(path != "empty") {
setZooms();
}
path = blankModule->path;
setZooms();
}

if (blankModule->imageFitEnum != lastEnum && lastEnum != -1) {
lastEnum = blankModule->imageFitEnum;
setZooms();
}
lastEnum = blankModule->imageFitEnum;
if (!path.empty()) {
if (!path.empty() && path!="empty") {
nvgBeginPath(args.vg);
NVGpaint imgPaint;
nvgScale(args.vg, blankModule->zoomX, blankModule->zoomY);
Expand Down

0 comments on commit bfbc782

Please sign in to comment.