Merge pull request #2908 from SillyTavern/gallery-improvements Improve gallery layout

57fdaeba81a3b06b12b64559bf17964b3c91c2df

Cohee <18619528+Cohee1207@users.noreply.github.com>

Signed
2 files changed, +8 -13Showing whitespace changes
public/scripts/extensions/gallery/index.js+8 -6
@@ -26,9 +26,11 @@ let paginationVisiblePages = 10;
26let paginationMaxLinesPerPage = 2;26let paginationMaxLinesPerPage = 2;
27let galleryMaxRows = 3;27let galleryMaxRows = 3;
2828
29$('body').on('click', '.dragClose', function () {29// Remove all draggables associated with the gallery
30 const relatedId = $(this).data('related-id'); // Get the ID of the related draggable30$('#movingDivs').on('click', '.dragClose', function () {
31 $(`body > .draggable[id="${relatedId}"]`).remove(); // Remove the associated draggable31 const relatedId = $(this).data('related-id');
32 if (!relatedId) return;
33 $(`#movingDivs > .draggable[id="${relatedId}"]`).remove();
32});34});
3335
34const CUSTOM_GALLERY_REMOVED_EVENT = 'galleryRemoved';36const CUSTOM_GALLERY_REMOVED_EVENT = 'galleryRemoved';
@@ -290,7 +292,7 @@ function makeMovable(id = 'gallery') {
290292
291 $('#dragGallery').css('display', 'block');293 $('#dragGallery').css('display', 'block');
292294
293 $('body').append(newElement);295 $('#movingDivs').append(newElement);
294296
295 loadMovingUIState();297 loadMovingUIState();
296 $(`.draggable[forChar="${id}"]`).css('display', 'block');298 $(`.draggable[forChar="${id}"]`).css('display', 'block');
@@ -362,8 +364,8 @@ function makeDragImg(id, url) {
362 }364 }
363 }365 }
364366
365 // Step 3: Attach it to the body367 // Step 3: Attach it to the movingDivs container
366 document.body.appendChild(newElement);368 document.getElementById('movingDivs').appendChild(newElement);
367369
368 // Step 4: Call dragElement and loadMovingUIState370 // Step 4: Call dragElement and loadMovingUIState
369 const appendedElement = document.getElementById(uniqueId);371 const appendedElement = document.getElementById(uniqueId);
public/style.css+0 -7
@@ -5386,13 +5386,6 @@ body:not(.movingUI) .drawer-content.maximized {
53865386
5387/* Jank mobile support for gallery and future draggables */5387/* Jank mobile support for gallery and future draggables */
5388@media screen and (max-width: 1000px) {5388@media screen and (max-width: 1000px) {
5389 #gallery {
5390 display: block;
5391 width: 100vw;
5392 height: 100vh;
5393 z-index: 9999;
5394 }
5395
5396 .draggable {5389 .draggable {
5397 display: block;5390 display: block;
5398 width: 100vw;5391 width: 100vw;