Skip to content

Commit

Permalink
Fix mapbox event binding
Browse files Browse the repository at this point in the history
By defining all emitted events, they are not accessible anymore from the
useAttrs() function, preventing the components to bind events to the
Mapbox objects.

Fix: #231
  • Loading branch information
titouanmathis committed Jan 8, 2025
1 parent 3fd2a43 commit 848cbac
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 14 deletions.
7 changes: 1 addition & 6 deletions packages/vue-mapbox-gl/components/MapboxCluster.vue
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,7 @@
import MapboxSource from './MapboxSource.vue';
const props = defineProps(propsConfig);
const emit = defineEmits([
'mb-cluster-click',
'mb-feature-click',
'mb-feature-mouseenter',
'mb-feature-mouseleave',
]);
const emit = defineEmits();

Check failure on line 133 in packages/vue-mapbox-gl/components/MapboxCluster.vue

View workflow job for this annotation

GitHub Actions / code-quality

Custom events are not defined
const { map } = useMap();
const id = ref(`mb-cluster-${index}`);
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-mapbox-gl/components/MapboxGeocoder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
import { useControl } from '../composables/index.js';
const props = defineProps(propsConfig);
const emit = defineEmits(events.map((event) => `mb-${event}`));
const emit = defineEmits();

Check failure on line 139 in packages/vue-mapbox-gl/components/MapboxGeocoder.vue

View workflow job for this annotation

GitHub Actions / code-quality

Custom events are not defined
const root = ref();
const options = computed(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
import { useControl } from '../composables/index.js';
const props = defineProps(propsConfig);
const emit = defineEmits(events.map((event) => `mb-${event}`));
const emit = defineEmits();

Check failure on line 70 in packages/vue-mapbox-gl/components/MapboxGeolocateControl.vue

View workflow job for this annotation

GitHub Actions / code-quality

Custom events are not defined
const { control } = useControl(GeolocateControl, { propsConfig, events, props, emit });
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-mapbox-gl/components/MapboxImage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
import { useMap } from '../composables/index.js';
const props = defineProps(propsConfig);
const emit = defineEmits(['mb-add']);
const emit = defineEmits();

Check failure on line 50 in packages/vue-mapbox-gl/components/MapboxImage.vue

View workflow job for this annotation

GitHub Actions / code-quality

Custom events are not defined
const { map } = useMap();
const isReady = ref(false);
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-mapbox-gl/components/MapboxImages.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
required: true,
},
});
const emit = defineEmits(['mb-add', 'mb-ready']);
const emit = defineEmits();

Check failure on line 28 in packages/vue-mapbox-gl/components/MapboxImages.vue

View workflow job for this annotation

GitHub Actions / code-quality

Custom events are not defined
const isReady = ref(false);
const addedImages = new Map();
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-mapbox-gl/components/MapboxLayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
import { useEventsBinding, useMap } from '../composables/index.js';
const props = defineProps(propsConfig);
const emit = defineEmits(events.map((event) => `mb-${event}`));
const emit = defineEmits();

Check failure on line 64 in packages/vue-mapbox-gl/components/MapboxLayer.vue

View workflow job for this annotation

GitHub Actions / code-quality

Custom events are not defined
const { map } = useMap();
const options = computed(() => {
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-mapbox-gl/components/MapboxMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@
import { useEventsBinding, usePropsBinding } from '../composables/index.js';
const props = defineProps(propsConfig);
const emit = defineEmits(events.map((event) => `mb-${event}`));
const emit = defineEmits();

Check failure on line 307 in packages/vue-mapbox-gl/components/MapboxMap.vue

View workflow job for this annotation

GitHub Actions / code-quality

Custom events are not defined
const map = shallowRef<Map>(null);
provide('mapbox-map', map);
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-mapbox-gl/components/MapboxMarker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
import MapboxPopup from './MapboxPopup.vue';
const props = defineProps(propsConfig);
const emit = defineEmits(events.map((event) => `mb-${event}`));
const emit = defineEmits();

Check failure on line 95 in packages/vue-mapbox-gl/components/MapboxMarker.vue

View workflow job for this annotation

GitHub Actions / code-quality

Custom events are not defined
const slots = useSlots();
const marker = shallowRef();
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-mapbox-gl/components/MapboxPopup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
import { useMap, usePropsBinding, useEventsBinding } from '../composables/index.js';
const props = defineProps(propsConfig);
const emit = defineEmits(['mb-open', 'mb-close']);
const emit = defineEmits();

Check failure on line 76 in packages/vue-mapbox-gl/components/MapboxPopup.vue

View workflow job for this annotation

GitHub Actions / code-quality

Custom events are not defined
const popup = shallowRef();
const root = ref();
Expand Down

0 comments on commit 848cbac

Please sign in to comment.