split-timeline: fix small timeline behavior
Signed-off-by: Varun Patil <varunpatil@ucla.edu>pull/563/head
parent
effb80b1fd
commit
952f781d70
|
@ -78,14 +78,8 @@ export default defineComponent({
|
||||||
direction: Hammer.DIRECTION_VERTICAL,
|
direction: Hammer.DIRECTION_VERTICAL,
|
||||||
threshold: 3,
|
threshold: 3,
|
||||||
});
|
});
|
||||||
this.hammer.on(
|
this.hammer.on("swipeup", this.mobileSwipeUp);
|
||||||
"swipeup",
|
this.hammer.on("swipedown", this.mobileSwipeDown);
|
||||||
() => (this.mobileOpen = Math.min(this.mobileOpen + 1, 2))
|
|
||||||
);
|
|
||||||
this.hammer.on(
|
|
||||||
"swipedown",
|
|
||||||
() => (this.mobileOpen = Math.max(this.mobileOpen - 1, 0))
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
|
@ -145,6 +139,27 @@ export default defineComponent({
|
||||||
daysLoaded({ count }: { count: number }) {
|
daysLoaded({ count }: { count: number }) {
|
||||||
this.photoCount = count;
|
this.photoCount = count;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async mobileSwipeUp() {
|
||||||
|
this.mobileOpen = Math.min(this.mobileOpen + 1, 2);
|
||||||
|
|
||||||
|
// When swiping up, immediately emit a resize event
|
||||||
|
// so that we can prepare in advance for showing more photos
|
||||||
|
// on the timeline
|
||||||
|
await this.$nextTick();
|
||||||
|
emit("memories:window:resize", null);
|
||||||
|
},
|
||||||
|
|
||||||
|
async mobileSwipeDown() {
|
||||||
|
this.mobileOpen = Math.max(this.mobileOpen - 1, 0);
|
||||||
|
|
||||||
|
// When swiping down, wait for the animation to end, so that
|
||||||
|
// we don't hide the lower half of the timeline before the animation
|
||||||
|
// ends. Note that this is necesary: the height of the timeline inner
|
||||||
|
// div is also animated to the smaller size.
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 300));
|
||||||
|
emit("memories:window:resize", null);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -244,10 +259,10 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
|
|
||||||
> .timeline {
|
> .timeline {
|
||||||
height: 100%;
|
height: 50%;
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
will-change: transform;
|
will-change: transform, height;
|
||||||
transition: transform 0.2s ease;
|
transition: transform 0.2s ease, height 0.2s ease;
|
||||||
border-top-left-radius: 20px;
|
border-top-left-radius: 20px;
|
||||||
border-top-right-radius: 20px;
|
border-top-right-radius: 20px;
|
||||||
|
|
||||||
|
@ -277,18 +292,19 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
|
|
||||||
&.m-zero > .timeline {
|
&.m-zero > .timeline {
|
||||||
transform: translateY(calc(100% - 60px)); // show attribution
|
transform: translateY(calc(200% - 60px)); // show attribution
|
||||||
}
|
}
|
||||||
&.m-zero > .primary {
|
&.m-zero > .primary {
|
||||||
height: calc(100% - 60px); // show full map
|
height: calc(100% - 60px); // show full map
|
||||||
}
|
}
|
||||||
|
|
||||||
&.m-one > .timeline {
|
&.m-one > .timeline {
|
||||||
transform: translateY(calc(50%)); // show half map
|
transform: translateY(100%); // show half map
|
||||||
}
|
}
|
||||||
|
|
||||||
&.m-two > .timeline {
|
&.m-two > .timeline {
|
||||||
transform: translateY(0); // show timeline
|
transform: translateY(0); // show timeline
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue