<commit_before><template>
  <div class="placeholder">
    <GroupMap
      class="map"
      controls="full"
      :users="users"
      :places="places"
      :groups="groups"
      :current-group="currentGroup"
      :is-editor="isEditor"
      :force-center="center"
      :force-zoom="zoom"
      :show-users="showUsers"
      :show-places="showPlaces"
      :show-groups="showGroups"
      @mapMoveEnd="mapMoveEnd"
      @toggleUsers="toggleUsers"
      @togglePlaces="togglePlaces"
      @toggleGroups="toggleGroups"
    />
  </div>
</template>

<script>

import GroupMap from '@/maps/components/GroupMap'

import { mapGetters, mapActions } from 'vuex'

export default {
  components: { GroupMap },
  computed: {
    ...mapGetters({
      places: 'places/byCurrentGroup',
      users: 'users/byCurrentGroup',
      groups: 'groups/all',
      currentGroup: 'currentGroup/value',
      isEditor: 'currentGroup/isEditor',
      showPlaces: 'sidenavBoxes/toggle/placesOnMap',
      showUsers: 'sidenavBoxes/toggle/usersOnMap',
      showGroups: 'sidenavBoxes/toggle/groupsOnMap',
    }),
    center () {
      return { lat: Number(this.$route.query.lat), lng: Number(this.$route.query.lng) }
    },
    zoom () {
      return Number(this.$route.query.zoom)
    },
  },
  methods: {
    ...mapActions({
      togglePlaces: 'sidenavBoxes/toggle/placesOnMap',
      toggleUsers: 'sidenavBoxes/toggle/usersOnMap',
      toggleGroups: 'sidenavBoxes/toggle/groupsOnMap',
    }),
    mapMoveEnd (target) {
      this.$router.replace({ query: { lat: target.getCenter().lat, lng: target.getCenter().lng, zoom: target.getZoom() } })
    },
  },
}
</script>

<style lang="stylus">
.map
  height 100%
  width 100%
.placeholder
  height 100%
  width 100%
  position absolute
  left 0
  top 0
</style>
<commit_msg>prevent NavigationDuplicated on map zoom<commit_after><template>
  <div class="placeholder">
    <GroupMap
      class="map"
      controls="full"
      :users="users"
      :places="places"
      :groups="groups"
      :current-group="currentGroup"
      :is-editor="isEditor"
      :force-center="center"
      :force-zoom="zoom"
      :show-users="showUsers"
      :show-places="showPlaces"
      :show-groups="showGroups"
      @mapMoveEnd="mapMoveEnd"
      @toggleUsers="toggleUsers"
      @togglePlaces="togglePlaces"
      @toggleGroups="toggleGroups"
    />
  </div>
</template>

<script>

import GroupMap from '@/maps/components/GroupMap'

import { mapGetters, mapActions } from 'vuex'

import { throttle } from 'quasar'

export default {
  components: { GroupMap },
  computed: {
    ...mapGetters({
      places: 'places/byCurrentGroup',
      users: 'users/byCurrentGroup',
      groups: 'groups/all',
      currentGroup: 'currentGroup/value',
      isEditor: 'currentGroup/isEditor',
      showPlaces: 'sidenavBoxes/toggle/placesOnMap',
      showUsers: 'sidenavBoxes/toggle/usersOnMap',
      showGroups: 'sidenavBoxes/toggle/groupsOnMap',
    }),
    center () {
      return { lat: Number(this.$route.query.lat), lng: Number(this.$route.query.lng) }
    },
    zoom () {
      return Number(this.$route.query.zoom)
    },
  },
  created () {
    this.mapMoveEnd = throttle(this.mapMoveEnd, 500)
  },
  methods: {
    ...mapActions({
      togglePlaces: 'sidenavBoxes/toggle/placesOnMap',
      toggleUsers: 'sidenavBoxes/toggle/usersOnMap',
      toggleGroups: 'sidenavBoxes/toggle/groupsOnMap',
    }),
    mapMoveEnd (target) {
      this.$router.replace({
        query: {
          lat: target.getCenter().lat,
          lng: target.getCenter().lng,
          zoom: target.getZoom(),
        },
      })
    },
  },
}
</script>

<style lang="stylus">
.map
  height 100%
  width 100%
.placeholder
  height 100%
  width 100%
  position absolute
  left 0
  top 0
</style>

{'fraction_non_alphanumeric': 0.14850962806647322, 'fraction_numerical': 0.0081772619361646, 'mean_word_length': 2.909278350515464, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '80105', 'n_tokens_mistral': 1297, 'n_tokens_neox': 1250, 'n_words': 214}