mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-06-20 18:08:00 +02:00
Merge branch 'gallery' of github.com:ManInDark/easydiffusion into gallery
This commit is contained in:
commit
fa9ff7f957
@ -150,6 +150,7 @@ let galleryPrevBtn = document.querySelector("#gallery-prev")
|
||||
let galleryNextBtn = document.querySelector("#gallery-next")
|
||||
let galleryPromptSearchField = document.querySelector("#gallery-prompt-search")
|
||||
let galleryModelSearchField = document.querySelector("#gallery-model-search")
|
||||
let galleryImageContainer = document.querySelector("#imagecontainer")
|
||||
|
||||
|
||||
let positiveEmbeddingText = document.querySelector("#positive-embedding-text")
|
||||
@ -3165,13 +3166,13 @@ function galleryImage(reqData) {
|
||||
|
||||
img.addEventListener("click", function() {
|
||||
function previousImage(img) {
|
||||
const allImages = Array.from(document.getElementById("imagecontainer").querySelectorAll(".gallery-image img"))
|
||||
const allImages = Array.from(galleryImageContainer.querySelectorAll(".gallery-image img"))
|
||||
const index = allImages.indexOf(img)
|
||||
return allImages.slice(0, index).reverse()[0]
|
||||
}
|
||||
|
||||
function nextImage(img) {
|
||||
const allImages = Array.from(document.getElementById("imagecontainer").querySelectorAll(".gallery-image img"))
|
||||
const allImages = Array.from(galleryImageContainer.querySelectorAll(".gallery-image img"))
|
||||
const index = allImages.indexOf(img)
|
||||
return allImages.slice(index + 1)[0]
|
||||
}
|
||||
@ -3257,12 +3258,11 @@ window.addEventListener("resize", layoutGallery)
|
||||
|
||||
|
||||
function layoutGallery() {
|
||||
let container = document.getElementById("imagecontainer")
|
||||
let thumbSize = parseFloat(galleryThumbnailSize.value)
|
||||
thumbSize = (10*thumbSize*thumbSize)>>>0
|
||||
let root = document.querySelector(':root')
|
||||
root.style.setProperty('--gallery-width', thumbSize + "px")
|
||||
let msnry = new Masonry( container, {
|
||||
let msnry = new Masonry(galleryImageContainer, {
|
||||
gutter: 10,
|
||||
itemSelector: '.gallery-image',
|
||||
columnWidth: thumbSize,
|
||||
@ -3279,11 +3279,10 @@ function refreshGallery(newsearch = false) {
|
||||
if (newsearch) {
|
||||
galleryPageField.value = 0
|
||||
}
|
||||
let container = document.getElementById("imagecontainer")
|
||||
container.innerHTML = ""
|
||||
galleryImageContainer.innerHTML = ""
|
||||
let params = new URLSearchParams({
|
||||
prompt: document.getElementById("gallery-prompt-search").value,
|
||||
model: document.getElementById("gallery-model-search").value,
|
||||
prompt: galleryPromptSearchField.value,
|
||||
model: galleryModelSearchField.value,
|
||||
page: galleryPageField.value
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user