Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Add a MapboxFullscreenControl component #177

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/demo/pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<script setup>

Check warning on line 1 in packages/demo/pages/index.vue

View workflow job for this annotation

GitHub Actions / Code-Quality

Component name "index" should always be multi-word.
import { ref, computed } from 'vue';
import {
MapboxGeocoder,
Expand All @@ -11,6 +11,7 @@
MapboxNavigationControl,
MapboxPopup,
MapboxCluster,
MapboxFullscreenControl,
} from '@studiometa/vue-mapbox-gl';
import 'mapbox-gl/dist/mapbox-gl.css';
import '@mapbox/mapbox-gl-geocoder/lib/mapbox-gl-geocoder.css';
Expand Down Expand Up @@ -84,6 +85,7 @@
:zoom="zoom"
@mb-created="createdHandler"
@mb-click="eventHandler">
<MapboxFullscreenControl position="bottom-left" />
<MapboxImages :sources="iconSources">
<MapboxLayer id="pois" :options="layerOptions" />
</MapboxImages>
Expand Down
34 changes: 34 additions & 0 deletions packages/vue-mapbox-gl/components/MapboxFullscreenControl.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<script>
import mapboxgl from 'mapbox-gl';

if (!mapboxgl) {
throw new Error('mapboxgl is not installed.');
}

/**
* Component's props definition, we need to declare it outside the component
* to be able to test the default values and the types.
* @see https://docs.mapbox.com/mapbox-gl-js/api/markers/#fullscreencontrol
* @type {object}
*/
const propsConfig = {
// eslint-disable-next-line vue/require-default-prop
container: typeof HTMLElement !== 'undefined' ? HTMLElement : Object,
position: {
type: String,
default: 'top-right',
},
};
</script>

<script setup>
import { useControl } from '../composables/index.js';

const props = defineProps(propsConfig);
const { control, map } = useControl(mapboxgl.FullscreenControl, {
propsConfig,
props,
});

defineExpose({ control });
</script>
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 @@ -15,7 +15,7 @@
}

/**
*Component's props definition, we need to declare it outside the component
* Component's props definition, we need to declare it outside the component
* to be able to test the default values and the types.
* @see https://github.com/mapbox/mapbox-gl-geocoder/blob/master/API.md#parameters
* @type {object}
Expand Down
1 change: 1 addition & 0 deletions packages/vue-mapbox-gl/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ export { default as MapboxMarker } from './MapboxMarker.vue';
export { default as MapboxNavigationControl } from './MapboxNavigationControl.vue';
export { default as MapboxPopup } from './MapboxPopup.vue';
export { default as MapboxSource } from './MapboxSource.vue';
export { default as MapboxFullscreenControl } from './MapboxFullscreenControl.vue';
Loading