Merge pull request #1086 from city-unit/feature/exorcism

Minor Gallery Fixes
This commit is contained in:
RossAscends 2023-09-03 05:42:58 +09:00 committed by GitHub
commit 942f343915
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 12 deletions

View File

@ -557,6 +557,12 @@ export function dragElement(elmnt) {
//set a listener for mouseup to save new width/height //set a listener for mouseup to save new width/height
elmnt.off('mouseup').on('mouseup', () => { elmnt.off('mouseup').on('mouseup', () => {
console.debug(`Saving ${elmntName} Height/Width`) console.debug(`Saving ${elmntName} Height/Width`)
// check if the height or width actually changed
if (power_user.movingUIState[elmntName].width === width && power_user.movingUIState[elmntName].height === height) {
console.debug('no change detected, aborting save')
return
}
power_user.movingUIState[elmntName].width = width; power_user.movingUIState[elmntName].width = width;
power_user.movingUIState[elmntName].height = height; power_user.movingUIState[elmntName].height = height;
eventSource.emit('resizeUI', elmntName); eventSource.emit('resizeUI', elmntName);

View File

@ -75,20 +75,8 @@ async function initGallery(items, url) {
fnThumbnailOpen: viewWithDragbox, fnThumbnailOpen: viewWithDragbox,
}); });
$(document).ready(function () {
$('.nGY2GThumbnailImage').on('click', function () {
let imageUrl = $(this).find('.nGY2GThumbnailImg').attr('src');
// Do what you want with the imageUrl, for example:
// Display it in a full-size view or replace the gallery grid content with this image
console.log(imageUrl);
});
});
eventSource.on('resizeUI', function (elmntName) { eventSource.on('resizeUI', function (elmntName) {
console.log('resizeUI saw', elmntName);
// Your logic here
// If you want to resize the nanogallery2 instance when this event is triggered:
jQuery("#dragGallery").nanogallery2('resize'); jQuery("#dragGallery").nanogallery2('resize');
}); });
@ -98,6 +86,8 @@ async function initGallery(items, url) {
dropZone.off('dragleave'); dropZone.off('dragleave');
dropZone.off('drop'); dropZone.off('drop');
// Set dropzone height to be the same as the parent
dropZone.css('height', dropZone.parent().css('height'));
// Initialize dropzone handlers // Initialize dropzone handlers
dropZone.on('dragover', function (e) { dropZone.on('dragover', function (e) {

View File

@ -3593,3 +3593,19 @@ a {
height: 100%; height: 100%;
object-fit: cover; object-fit: cover;
} }
/* Jank mobile support for gallery and future draggables */
@media screen and (max-width: 1000px) {
#gallery {
display: block;
width: 100vw;
height: 100vh;
z-index: 9999;
}
.draggable {
display: block;
width: 100vw;
height: 100vh;
z-index: 9999;
}
}