Skip to content

Commit b0f2f38

Browse files
author
Wray Bowling
committed
defaultMode is tracked by and set by all user changes, now affects list scroll position
1 parent 6a44637 commit b0f2f38

3 files changed

Lines changed: 20 additions & 14 deletions

File tree

src/components/EventList.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,20 @@
2323
}
2424
},
2525
computed: {
26+
defaultMode: function(){ return this.$store.state.defaultMode },
2627
now: function(){ return this.events.filter(event => event.now)},
2728
later: function(){ return this.events.filter(event => !event.now)}
2829
},
30+
watch: {
31+
defaultMode(e){
32+
if(e){
33+
this.$el.scrollTop = 0
34+
}
35+
}
36+
},
37+
mounted(){
38+
console.log(this.$el)
39+
},
2940
mixins:[vueinterval],
3041
components: {EventItem},
3142
methods: {

src/components/Map.vue

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<div @touchstart="setLevel(1)" :class="{'viewing': floorViewing === 1, 'you-are-here': floorStanding === 1}">1</div>
88
<div @touchstart="setLevel(0)" :class="{'viewing': floorViewing === 0, 'you-are-here': floorStanding === 0}">G</div>
99
</nav>
10-
<div class="overlay">Richland Library Main / Level {{floorStanding}}</div>
10+
<div class="overlay">You are on Level {{floorStanding}}</div>
1111
</div>
1212
</template>
1313

@@ -26,18 +26,14 @@
2626
zoom: 'zoom',
2727
bearing: 'bearing',
2828
center: 'center',
29-
resetCamera: 'resetCamera'
29+
defaultMode: 'defaultMode'
3030
}),
3131
watch: {
3232
floorViewing() {
3333
this.renderFloor()
3434
},
35-
resetCamera(e) {
36-
// console.log(e)
37-
// console.log('cam var',this.$store.resetCamera)
35+
defaultMode(e) {
3836
if(e){
39-
console.log('resetting')
40-
this.$store.commit('set',{ resetCamera: false })
4137
map.flyTo({
4238
duration:30000,
4339
zoom: this.zoom,
@@ -253,6 +249,7 @@
253249
color:white;
254250
padding:0.5em 2vw;
255251
font-weight:800;
252+
text-align:center;
256253
}
257254
}
258255

src/store/index.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ const store = new Vuex.Store({
1111
floorViewing: 1,
1212
zoom: 18.3,
1313
bearing: -70,
14-
center: {lng: -81.03735096824548, lat: 34.004175572139815},
14+
center: {lng: -81.03730200444548, lat: 34.00414146587417},
1515
room_id: undefined,
1616
event_id: undefined,
17-
resetCamera: false
17+
defaultMode: true
1818
},
1919
mutations: {
2020
set(state,payload) {
@@ -23,7 +23,6 @@ const store = new Vuex.Store({
2323
}
2424
},
2525
userSet(state,payload){
26-
console.log('userSet')
2726
this.commit('set',payload)
2827
resetState()
2928
}
@@ -40,15 +39,14 @@ export default store;
4039
// the defaults, stored within the current state, (and eventually local storage or firebase or etc)
4140
const defaultState = JSON.parse(JSON.stringify(store.state))
4241

43-
4442
function resetState() {
45-
console.log('...')
43+
store.commit('set', {defaultMode:false})
4644
clearTimeout(debouncer);
4745
debouncer = setTimeout(function(){
4846
console.log('!!!')
4947
let s = defaultState
50-
s.resetCamera = true;
48+
s.defaultMode = true;
5149
store.commit('set', s)
5250
//console.log(store)
53-
},15000)
51+
},10000)
5452
}

0 commit comments

Comments
 (0)