mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-08-08 23:44:39 +02:00
@ -59,29 +59,6 @@ let maskSetting = document.querySelector('#enable_mask')
|
||||
|
||||
const processOrder = document.querySelector('#process_order_toggle')
|
||||
|
||||
const editorContainer = document.querySelector('#editor')
|
||||
window.addEventListener("scroll", updatePreviewSize)
|
||||
let lastScrollTop = 0
|
||||
updatePreviewSize()
|
||||
|
||||
// update preview pane size and position
|
||||
function updatePreviewSize() {
|
||||
const scrollTop = window.pageYOffset || document.documentElement.scrollTop
|
||||
if (scrollTop > lastScrollTop) {
|
||||
previewTools.style.top = -previewTools.offsetHeight + 'px'
|
||||
}
|
||||
else if (scrollTop < lastScrollTop) {
|
||||
const elem = preview.getElementsByClassName('img-batch')[0]
|
||||
if (elem !== undefined && Math.round(window.scrollY) !== Math.round(elem.closest(".imageTaskContainer").offsetTop)) {
|
||||
previewTools.style.top = '0'
|
||||
}
|
||||
}
|
||||
lastScrollTop = scrollTop
|
||||
|
||||
$('#editor').css('top', Math.max(-window.pageYOffset + $("#tab-container").offset().top + $('#tab-container').outerHeight(true), 0) + 'px')
|
||||
$('#editor').css('bottom', Math.max($(window).height() - ($("#footer .line-separator").offset().top - $(document).scrollTop()), 0) + 'px')
|
||||
};
|
||||
|
||||
let imagePreview = document.querySelector("#preview")
|
||||
imagePreview.addEventListener('drop', function(ev) {
|
||||
const data = ev.dataTransfer?.getData("text/plain");
|
||||
@ -290,9 +267,9 @@ function showImages(reqBody, res, outputContainer, livePreview) {
|
||||
imageElem.setAttribute('data-steps', imageInferenceSteps)
|
||||
imageElem.setAttribute('data-guidance', imageGuidanceScale)
|
||||
|
||||
|
||||
const imageInfo = imageItemElem.querySelector('.imgItemInfo')
|
||||
imageInfo.style.visibility = (livePreview ? 'hidden' : 'visible')
|
||||
updatePreviewSize()
|
||||
|
||||
if ('seed' in result && !imageElem.hasAttribute('data-seed')) {
|
||||
const req = Object.assign({}, reqBody, {
|
||||
@ -434,7 +411,11 @@ function getUncompletedTaskEntries() {
|
||||
document.querySelectorAll('#preview .imageTaskContainer .taskStatusLabel')
|
||||
).filter((taskLabel) => taskLabel.style.display !== 'none'
|
||||
).map(function(taskLabel) {
|
||||
return taskLabel.closest('.imageTaskContainer')
|
||||
let imageTaskContainer = taskLabel.parentNode
|
||||
while(!imageTaskContainer.classList.contains('imageTaskContainer') && imageTaskContainer.parentNode) {
|
||||
imageTaskContainer = imageTaskContainer.parentNode
|
||||
}
|
||||
return imageTaskContainer
|
||||
})
|
||||
if (!processOrder.checked) {
|
||||
taskEntries.reverse()
|
||||
@ -842,7 +823,7 @@ function createTask(task) {
|
||||
let question = (task['isProcessing'] ? "Stop this task?" : "Remove this task?")
|
||||
shiftOrConfirm(e, question, async function(e) {
|
||||
if (task.batchesDone <= 0 || !task.isProcessing) {
|
||||
removeTask(taskEntry)
|
||||
taskEntry.remove()
|
||||
}
|
||||
abortTask(task)
|
||||
})
|
||||
@ -1073,7 +1054,6 @@ function removeTask(taskToRemove) {
|
||||
previewTools.style.display = 'none'
|
||||
initialText.style.display = 'block'
|
||||
}
|
||||
updatePreviewSize()
|
||||
}
|
||||
|
||||
clearAllPreviewsBtn.addEventListener('click', (e) => { shiftOrConfirm(e, "Clear all the results and tasks in this window?", async function() {
|
||||
|
Reference in New Issue
Block a user