-
Notifications
You must be signed in to change notification settings - Fork 7
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
9a7d225
commit baa8821
Showing
47 changed files
with
2,521 additions
and
1,484 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 @@ | ||
{} |
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 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 |
---|---|---|
@@ -1,28 +1,36 @@ | ||
import { defineComponent, inject, onBeforeUnmount, type PropType } from 'vue'; | ||
import { AttributionControl } from 'maplibre-gl'; | ||
import { Position, type PositionProp, PositionValues } from '@/lib/components/controls/position.enum'; | ||
import { isInitializedSymbol, mapSymbol } from '@/lib/types'; | ||
import { usePositionWatcher } from '@/lib/composable/usePositionWatcher'; | ||
import { defineComponent, inject, onBeforeUnmount, type PropType } from "vue"; | ||
import { AttributionControl } from "maplibre-gl"; | ||
import { | ||
Position, | ||
type PositionProp, | ||
PositionValues, | ||
} from "@/lib/components/controls/position.enum"; | ||
import { isInitializedSymbol, mapSymbol } from "@/lib/types"; | ||
import { usePositionWatcher } from "@/lib/composable/usePositionWatcher"; | ||
|
||
export default /*#__PURE__*/ defineComponent({ | ||
name : 'MglAttributionControl', | ||
name: "MglAttributionControl", | ||
props: { | ||
position : { | ||
type : String as PropType<PositionProp>, | ||
position: { | ||
type: String as PropType<PositionProp>, | ||
validator: (v: Position) => { | ||
return PositionValues.indexOf(v) !== -1; | ||
} | ||
return PositionValues.indexOf(v) !== -1; | ||
}, | ||
}, | ||
compact : Boolean as PropType<boolean>, | ||
customAttribution: [ String, Array ] as PropType<string | string[]> | ||
compact: Boolean as PropType<boolean>, | ||
customAttribution: [String, Array] as PropType<string | string[]>, | ||
}, | ||
setup(props) { | ||
const map = inject(mapSymbol)!, | ||
isInitialized = inject(isInitializedSymbol)!, | ||
control = new AttributionControl({ compact: props.compact, customAttribution: props.customAttribution }); | ||
const map = inject(mapSymbol)!, | ||
isInitialized = inject(isInitializedSymbol)!, | ||
control = new AttributionControl({ | ||
compact: props.compact, | ||
customAttribution: props.customAttribution, | ||
}); | ||
|
||
usePositionWatcher(() => props.position, map, control); | ||
onBeforeUnmount(() => isInitialized.value && map.value!.removeControl(control)); | ||
|
||
} | ||
onBeforeUnmount( | ||
() => isInitialized.value && map.value!.removeControl(control), | ||
); | ||
}, | ||
}); |
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
Oops, something went wrong.