Skip to content

Commit

Permalink
Add ZoomToMaxExtentButton component
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismayer committed Jun 27, 2018
1 parent 15609a8 commit 903909e
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/WguApp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

<v-toolbar-items slot="wgu-tb-buttons" class="">

<wgu-zoomtomaxextent-button
icon="zoom_out_map"
text=""
/>

<wgu-toggle-layerlist-button
icon="layers"
text=""
Expand Down Expand Up @@ -55,6 +60,7 @@ import LayerListToggleButton from './components/layerlist/ToggleButton'
import HelpWinToggleButton from './components/helpwin/ToggleButton'
import MeasureToolToggleButton from './components/measuretool/ToggleButton'
import InfoClickButton from './components/infoclick/ToggleButton'
import ZoomToMaxExtentButton from './components/maxextentbutton/ZoomToMaxExtentButton'
export default {
name: 'app',
Expand All @@ -68,7 +74,8 @@ export default {
'wgu-toggle-layerlist-button': LayerListToggleButton,
'wgu-toggle-helpwin-button': HelpWinToggleButton,
'wgu-toggle-measuretool-button': MeasureToolToggleButton,
'wgu-toggle-infoclick-button': InfoClickButton
'wgu-toggle-infoclick-button': InfoClickButton,
'wgu-zoomtomaxextent-button': ZoomToMaxExtentButton
},
data () {
return {
Expand Down
40 changes: 40 additions & 0 deletions src/components/maxextentbutton/ZoomToMaxExtentButton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<template>

<div class="">

<v-btn icon @click="onClick">
<v-icon medium>{{icon}}</v-icon>
{{text}}
</v-btn>

</div>

</template>

<script>
import { Mapable } from '../../mixins/Mapable';
export default {
name: 'wgu-zoomtomaxextent-button',
mixins: [Mapable],
props: {
icon: {type: String, required: false},
text: {type: String, required: false}
},
methods: {
onClick () {
// derive correct initial zoom and center
const initialCenter = this.$appConfig.mapCenter;
const initalZoom = this.$appConfig.mapZoom
this.map.getView().setCenter(initialCenter);
this.map.getView().setZoom(initalZoom);
}
}
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style>
</style>

0 comments on commit 903909e

Please sign in to comment.