'keep current ratio' fixed in a way it aligns with previous version
This commit is contained in:
parent
5b37019741
commit
00f2440ae8
24
js/File.js
24
js/File.js
|
@ -38,6 +38,8 @@ class File {
|
|||
keepRatio = true;
|
||||
// Used to store the current ratio
|
||||
currentRatio = undefined;
|
||||
// check for first init run
|
||||
kcrInit = 0
|
||||
// The currenty selected resizing algorithm (nearest-neighbor or bilinear-interpolation)
|
||||
currentAlgo = 'nearest-neighbor';
|
||||
// Current resize data
|
||||
|
@ -421,14 +423,22 @@ class File {
|
|||
document.getElementById("rs-width").value = currFile.canvasSize[0];
|
||||
document.getElementById("rs-height").value = currFile.canvasSize[1];
|
||||
|
||||
const isChecked = document.getElementById("rs-keep-ratio").checked
|
||||
if (isChecked) {
|
||||
document.getElementById("rs-width-percentage").value = this.data.heightPercentage
|
||||
document.getElementById("rs-height-percentage").value = this.data.heightPercentage
|
||||
} else {
|
||||
document.getElementById("rs-width-percentage").value = 100;
|
||||
document.getElementById("rs-height-percentage").value = 100;
|
||||
|
||||
if (this.kcrInit == 0) {
|
||||
document.getElementById("rs-keep-ratio").checked = true
|
||||
this.kcrInit++
|
||||
} {
|
||||
const isChecked = document.getElementById("rs-keep-ratio").checked
|
||||
if (isChecked) {
|
||||
document.getElementById("rs-width-percentage").value = this.data.heightPercentage
|
||||
document.getElementById("rs-height-percentage").value = this.data.heightPercentage
|
||||
} else {
|
||||
document.getElementById("rs-width-percentage").value = 100;
|
||||
document.getElementById("rs-height-percentage").value = 100;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Events.on("change", "rs-width", this.changedWidth.bind(this));
|
||||
Events.on("change", "rs-height", this.changedHeight.bind(this));
|
||||
|
|
Loading…
Reference in New Issue