fixed ration binding

This commit is contained in:
klemek
2019-12-07 00:53:29 +01:00
parent cd83389e1d
commit b588123195
+19 -9
View File
@@ -126,8 +126,6 @@ let app = {
this.finishedH = false; this.finishedH = false;
this.finishedV = false; this.finishedV = false;
this.incomplete = false; this.incomplete = false;
this.fbw = false;
this.fbh = false;
['sw', 'sh', 'm', 'n', 'bw', 'bh', 'rw', 'rh', 'mh', 'mv', 'ph', 'pv'].forEach(name => { ['sw', 'sh', 'm', 'n', 'bw', 'bh', 'rw', 'rh', 'mh', 'mv', 'ph', 'pv'].forEach(name => {
if (self[name]) { if (self[name]) {
Vue.set(self, name, parseFloat(self[name])); Vue.set(self, name, parseFloat(self[name]));
@@ -137,14 +135,26 @@ let app = {
this.incomplete = true; this.incomplete = true;
} else { } else {
if (this.ratio && this.rw && this.rh) { if (this.ratio && this.rw && this.rh) {
if (this.bh && !this.fbw) { if (!this.fbw && !this.fbh) {
this.fbw = true; if (this.bh) {
this.bw = utils.round(this.bh * this.rw / this.rh, 2); this.fbw = true;
} this.bw = utils.round(this.bh * this.rw / this.rh, 2);
if (this.bw && !this.fbh) { } else if (this.bw) {
this.fbh = true; this.fbh = true;
this.bh = utils.round(this.bw * this.rh / this.rw, 2); this.bh = utils.round(this.bw * this.rh / this.rw, 2);
}
} else {
if (this.fbw && !this.bh) {
this.fbw = false;
this.bw = undefined;
} else if (this.fbh && !this.bw) {
this.fbh = false;
this.bh = undefined;
}
} }
} else {
this.fbw = false;
this.fbh = false;
} }
if (this.padding) { if (this.padding) {
const uh = !this.bw + !this.mh + !this.ph; const uh = !this.bw + !this.mh + !this.ph;