Show the number of images it'll make in the Make Image button

This commit is contained in:
cmdr2 2022-10-21 15:18:05 +05:30
parent eb1a276e60
commit 329360aa5b
2 changed files with 18 additions and 3 deletions

View File

@ -267,7 +267,7 @@
<script src="media/js/inpainting-editor.js?v=1"></script>
<script src="media/js/image-modifiers.js?v=3"></script>
<script src="media/js/auto-save.js?v=1"></script>
<script src="media/js/main.js?v=3"></script>
<script src="media/js/main.js?v=4"></script>
<script src="media/js/themes.js?v=1"></script>
<script>
async function init() {

View File

@ -711,7 +711,7 @@ async function checkTasks() {
setStatus('request', 'done', 'success')
setTimeout(checkTasks, 500)
stopImageBtn.style.display = 'none'
makeImageBtn.innerHTML = 'Make Image'
renameMakeImageButton()
currentTask = null
@ -728,7 +728,7 @@ async function checkTasks() {
setStatus('request', 'fetching..')
stopImageBtn.style.display = 'block'
makeImageBtn.innerHTML = 'Enqueue Next Image'
renameMakeImageButton()
bellPending = true
previewTools.style.display = 'block'
@ -1123,6 +1123,21 @@ diskPathField.addEventListener('change', handleStringSettingChange(DISK_PATH_KEY
widthField.addEventListener('change', onDimensionChange)
heightField.addEventListener('change', onDimensionChange)
function renameMakeImageButton() {
let totalImages = Math.max(parseInt(numOutputsTotalField.value), parseInt(numOutputsParallelField.value))
let imageLabel = 'Image'
if (totalImages > 1) {
imageLabel = totalImages + ' Images'
}
if (taskQueue.length == 0) {
makeImageBtn.innerText = 'Make ' + imageLabel
} else {
makeImageBtn.innerText = 'Enqueue Next ' + imageLabel
}
}
numOutputsTotalField.addEventListener('change', renameMakeImageButton)
numOutputsParallelField.addEventListener('change', renameMakeImageButton)
function onDimensionChange() {
if (!maskSetting.checked) {
return