Restore desktop hover overlay

pull/162/head
Varun Patil 2022-10-30 14:28:18 -07:00
parent 49ebfdfd0f
commit 94280ecb0b
1 changed files with 25 additions and 2 deletions

View File

@ -35,6 +35,7 @@
@load="load" @load="load"
@error="error" @error="error"
/> />
<div class="overlay" />
</div> </div>
</div> </div>
</template> </template>
@ -60,6 +61,7 @@ export default class Photo extends Mixins(GlobalMixin) {
private touchTimer = 0; private touchTimer = 0;
private src = null; private src = null;
private hasFaceRect = false; private hasFaceRect = false;
private hasTouch = false;
@Prop() data: IPhoto; @Prop() data: IPhoto;
@Prop() day: IDay; @Prop() day: IDay;
@ -175,6 +177,7 @@ export default class Photo extends Mixins(GlobalMixin) {
} }
touchstart() { touchstart() {
this.hasTouch = true;
this.touchTimer = window.setTimeout(() => { this.touchTimer = window.setTimeout(() => {
this.toggleSelect(); this.toggleSelect();
this.touchTimer = 0; this.touchTimer = 0;
@ -182,8 +185,11 @@ export default class Photo extends Mixins(GlobalMixin) {
} }
contextmenu(e: Event) { contextmenu(e: Event) {
e.preventDefault(); // on mobile only
e.stopPropagation(); if (this.hasTouch) {
e.preventDefault();
e.stopPropagation();
}
} }
touchend() { touchend() {
@ -297,10 +303,27 @@ div.img-outer {
.p-outer.error & { .p-outer.error & {
object-fit: contain; object-fit: contain;
} }
}
& > .overlay {
pointer-events: none;
width: 100%;
height: 100%;
transform: translateY(-100%); // very weird stuff
background: linear-gradient(180deg, rgba(0, 0, 0, 0.2) 0%, transparent 30%);
opacity: 0;
transition: opacity 0.1s ease-in;
.p-outer:not(.selected):hover > & {
opacity: 1;
}
}
> * {
@media (max-width: 768px) { @media (max-width: 768px) {
.selected > & { .selected > & {
border-radius: $icon-size; border-radius: $icon-size;
border-top-left-radius: 0;
} }
} }
} }