Browse Source

Fix SVGSwitch value scaling, add confirmation for clearing the patch

with File > New
tags/v0.5.0
Andrew Belt 7 years ago
parent
commit
dfa723119b
2 changed files with 6 additions and 3 deletions
  1. +4
    -2
      src/app/RackWidget.cpp
  2. +2
    -1
      src/app/SVGSwitch.cpp

+ 4
- 2
src/app/RackWidget.cpp View File

@@ -41,8 +41,10 @@ void RackWidget::clear() {
}

void RackWidget::reset() {
clear();
loadPatch(assetLocal("template.vcv"));
if (osdialog_message(OSDIALOG_INFO, OSDIALOG_OK_CANCEL, "Clear your patch and start over?")) {
clear();
loadPatch(assetLocal("template.vcv"));
}
}

void RackWidget::openDialog() {


+ 2
- 1
src/app/SVGSwitch.cpp View File

@@ -24,7 +24,8 @@ void SVGSwitch::step() {

void SVGSwitch::onChange(EventChange &e) {
assert(frames.size() > 0);
int index = clampi((int) roundf(value), 0, frames.size() - 1);
float valueScaled = rescalef(value, minValue, maxValue, 0, frames.size() - 1);
int index = clampi((int) roundf(valueScaled), 0, frames.size() - 1);
sw->setSVG(frames[index]);
dirty = true;
Switch::onChange(e);


Loading…
Cancel
Save