add comments(Why didn’t I do this sooner?)

This commit is contained in:
Chaebean Yang 2025-06-10 01:47:37 +09:00
parent 32fa693b5c
commit fa8d3aa2a6

View File

@ -22,6 +22,7 @@
let droppedGradientLayers = [];
let droppedWheelStyle = {};
let droppedCurrentImage = null;
let isDroppedVisible = true;
$: tripId = $page.params.tripId;
$: memoryId = $page.params.memoryId;
@ -85,6 +86,7 @@
droppedMemory = memorySnap.val();
droppedColumnGroups = await extractColumnwiseColors(droppedMemory.images, false);
droppedImageIndex = 0;
isDroppedVisible = true;
}
}
@ -268,7 +270,7 @@
function handleDrop(event) {
event.preventDefault();
if (droppedMemory) return;
if (droppedMemory && isDroppedVisible) return;
const droppedTripId = event.dataTransfer.getData("tripId");
const droppedMemoryId = event.dataTransfer.getData("memoryId");
@ -276,10 +278,14 @@
}
function allowDrop(event) {
if (!droppedMemory) {
if (!droppedMemory || !isDroppedVisible) {
event.preventDefault();
}
}
function closeDroppedWheel() {
isDroppedVisible = false;
}
</script>
@ -336,7 +342,9 @@
<!-- rightside dropped view -->
<div class="wheel-section drop-zone" on:drop={handleDrop} on:dragover={allowDrop}>
{#if droppedMemory}
{#if droppedMemory && isDroppedVisible}
<img src="/lucide_x.png" alt="Close" class="close-button" on:click={closeDroppedWheel} />
<div class="dropped-mask">
<div class="dropped-wheel" style={droppedWheelStyle}>
{#each droppedGradientLayers as style}
@ -344,9 +352,11 @@
{/each}
</div>
</div>
{#if droppedCurrentImage}
<img class="dropped-img" src={droppedCurrentImage} alt="Dropped Image" />
{/if}
<div class="dropped-controls">
<button on:click={prevDroppedImage}>
<img src="/lucide_chevron-up.png" alt="Up" width="24" height="24" />
@ -570,5 +580,15 @@
right: -15vw;
border-radius: 50%;
}
.close-button {
position: absolute;
top: -48px;
right: 2rem;
width: 24px;
height: 24px;
cursor: pointer;
z-index: 5;
}
</style>