Skip to content

Commit 9162ae1

Browse files
add opacity blend mask at scroll container
1 parent bba9096 commit 9162ae1

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

src/photo-booth/src/components/CircuitSelection.vue

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
</div>
6262

6363
<!-- HORIZONTAL SCROLL -->
64-
<div class="circuit-scroll">
64+
<div class="circuit-scroll" :class="{ 'has-mask': !isFirstOrLastSelected }">
6565
<button
6666
v-for="circuit in filteredCircuits"
6767
:key="circuit.id"
@@ -169,7 +169,7 @@ const filteredCircuits = computed(() => {
169169
});
170170
171171
function selectCircuit(event, id) {
172-
event.target.scrollIntoView({behavior: "smooth"});
172+
event.currentTarget.scrollIntoView({behavior: "smooth"});
173173
emit("update:modelValue", id);
174174
}
175175
@@ -192,6 +192,13 @@ function handleClickOutside(event) {
192192
193193
window.addEventListener("click", handleClickOutside);
194194
195+
const isFirstOrLastSelected = computed(() => {
196+
if (!props.modelValue || filteredCircuits.value.length === 0) return true;
197+
const index = filteredCircuits.value.findIndex(c => c.id === props.modelValue);
198+
if (index === -1) return true;
199+
return index === 0 || index === filteredCircuits.value.length - 1;
200+
});
201+
195202
onBeforeUnmount(() => {
196203
window.removeEventListener("click", handleClickOutside);
197204
});
@@ -361,6 +368,11 @@ onBeforeUnmount(() => {
361368
@include big-screen {
362369
max-width: calc(75vw + 32px)
363370
}
371+
372+
&.has-mask {
373+
mask-image: linear-gradient(to right, transparent 6px, black 32px, black calc(100% - 32px), transparent);
374+
-webkit-mask-image: linear-gradient(to right, transparent 6px, black 32px, black calc(100% - 32px), transparent);
375+
}
364376
}
365377
366378
/* CARD */

0 commit comments

Comments
 (0)