Fix initial scroll position: dial centered on page show, snap-back offset 233
This commit is contained in:
@@ -81,6 +81,8 @@ export default {
|
||||
onShow() {
|
||||
if (this.destroyed) return
|
||||
this.visible = true
|
||||
this.crownAnchor = 233
|
||||
try { this.$element('scroller').scrollTo({ top: 233 }) } catch (err) {}
|
||||
this.records.sync()
|
||||
this.startTimer()
|
||||
},
|
||||
@@ -176,7 +178,7 @@ export default {
|
||||
onCrownScroll(e) {
|
||||
if (this.destroyed) return
|
||||
const top = e && typeof e.scrollTop === 'number' ? e.scrollTop : 0
|
||||
const center = 466
|
||||
const center = 233
|
||||
const d = top - (this.crownAnchor == null ? center : this.crownAnchor)
|
||||
this.crownAnchor = top
|
||||
if (d === 0) return
|
||||
@@ -228,10 +230,10 @@ export default {
|
||||
background-color: #000000;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
/* scrollable strip: dial centered in a 1398px-tall content so the crown
|
||||
always has travel to scroll against; page re-centers after each event */
|
||||
padding-top: 466px;
|
||||
padding-bottom: 466px;
|
||||
/* scrollable travel: dial centered in 932px content, 233px of crown travel
|
||||
each way; onReady + onscroll snap back to the center offset (233) */
|
||||
padding-top: 233px;
|
||||
padding-bottom: 233px;
|
||||
}
|
||||
.dial {
|
||||
width: 466px; height: 466px;
|
||||
|
||||
Reference in New Issue
Block a user