computerscare-vcv-modules

computerscare modules for VCV Rack
Log | Files | Refs

commit bfbc782f2787c6eadf6855a396e887a6ceab9b40
parent 5074befad399ec38ca5f09e26a9b78831172ff95
Author: Adam M <aemalone@gmail.com>
Date:   Mon, 11 Nov 2019 15:55:22 -0600

don't set zoom when loading from JSON

Diffstat:
Msrc/ComputerscareBlank.cpp | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/ComputerscareBlank.cpp b/src/ComputerscareBlank.cpp @@ -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() { @@ -190,8 +190,11 @@ 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) { @@ -199,7 +202,7 @@ struct PNGDisplay : TransparentWidget { setZooms(); } lastEnum = blankModule->imageFitEnum; - if (!path.empty()) { + if (!path.empty() && path!="empty") { nvgBeginPath(args.vg); NVGpaint imgPaint; nvgScale(args.vg, blankModule->zoomX, blankModule->zoomY);