-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c8558bc
commit 5d0d576
Showing
48 changed files
with
7,946 additions
and
10,766 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.* | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<script setup lang="ts"> | ||
import type { AttributionOptions, ControlPosition } from './types'; | ||
import { AttributionControl } from 'maplibre-gl'; | ||
import { onMounted } from 'vue'; | ||
import { MapKey, injectStrict } from '../../utils'; | ||
const defaultOptions: AttributionOptions = { | ||
compact: false, | ||
customAttribution: undefined, | ||
}; | ||
const props = withDefaults( | ||
defineProps<{ | ||
options?: AttributionOptions; | ||
position?: ControlPosition; | ||
}>(), | ||
{ | ||
options: undefined, | ||
position: 'bottom-right', | ||
}, | ||
); | ||
const slots = useSlots(); | ||
let map = injectStrict(MapKey); | ||
onMounted(() => { | ||
addControl(); | ||
}); | ||
const addControl = (): void => { | ||
let options = defaultOptions; | ||
if (props.options) { | ||
options = { | ||
...props.options, | ||
}; | ||
} | ||
if (slots && slots.default?.()) { | ||
options.customAttribution = slots.default()[0] | ||
.children as unknown as string; | ||
} | ||
const control = new AttributionControl(options); | ||
map.value.addControl(control, props.position); | ||
}; | ||
</script> | ||
|
||
<template> | ||
<slot /> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as AttributionControl } from './VControlAttribution.vue'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export type { AttributionOptions, ControlPosition } from 'maplibre-gl'; |
Oops, something went wrong.