Commit 1a50b71c authored by Fawad Mirzad's avatar Fawad Mirzad
Browse files

Improve code

parent 66bdd9a9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
{
  "name": "@fawmi/vue-google-maps",
  "description": "Google Map components for Vue.js 3",
  "version": "0.7.1",
  "version": "0.7.2",
  "private": false,
  "main": "src/main.js",
  "keywords": [
+7 −8
Original line number Diff line number Diff line
<template>
  <div><slot></slot></div>
  <div>
    <slot></slot>
  </div>
</template>
<script>
import MarkerClusterer from 'marker-clusterer-plus'
import buildComponent from './build-component.js'

const props = {
  maxZoom: {
    type: Number,
@@ -74,13 +77,9 @@ export default buildComponent({
  name: 'cluster',
  ctr: () => {
    if (typeof MarkerClusterer === 'undefined') {
      /* eslint-disable no-console */
      console.error(
        'MarkerClusterer is not installed! require() it or include it from https://cdnjs.cloudflare.com/ajax/libs/js-marker-clusterer/1.0.0/markerclusterer.js'
      )
      throw new Error(
        'MarkerClusterer is not installed! require() it or include it from https://cdnjs.cloudflare.com/ajax/libs/js-marker-clusterer/1.0.0/markerclusterer.js'
      )
      const errorMessage = 'MarkerClusterer is not installed!';
      console.error(errorMessage);
      throw new Error(errorMessage)
    }
    return MarkerClusterer
  },
+2 −4
Original line number Diff line number Diff line
<template>
  <div>
  <div ref="infoWindow">
    <slot></slot>
  </div>
  </div>
</template>

<script>

src/components/infoWindowImpl.js

deleted100644 → 0
+0 −0

Empty file deleted.

+8 −24
Original line number Diff line number Diff line
<template>
  <div v-if="$slots.default">
    <slot></slot>
  </div>
</template>
<script>

import buildComponent from './build-component.js'

const props = {
@@ -71,18 +78,6 @@ const events = [
  'mouseout',
]

/**
 * @class Marker
 *
 * Marker class with extra support for
 *
 * - Embedded info windows
 * - Clustered markers
 *
 * Support for clustered markers is for backward-compatability
 * reasons. Otherwise we should use a cluster-marker mixin or
 * subclass.
 */
export default buildComponent({
  mappedProps: props,
  events,
@@ -94,18 +89,6 @@ export default buildComponent({
      default: null,
    },
  },

  render(h) {
    if (!this.$slots.default || this.$slots.default.length === 0) {
      return ''
    } else if (this.$slots.default.length === 1) {
      // So that infowindows can have a marker parent
      return this.$slots.default[0]
    } else {
      return h('div', this.$slots.default)
    }
  },
  emits: ['center_changed', 'zoom_changed', 'bounds_changed'],
  unmounted() {
    if (!this.$markerObject) {
      return
@@ -136,3 +119,4 @@ export default buildComponent({
    }
  },
})
</script>
Loading