Release 1.0.0-next.7
Pre-release
Pre-release
·
375 commits
to main
since this release
- feat(ol-geolocation): pass-through original events (44249b5)
BREAKING CHANGES
ol-geolocation: pass-through original events from Openlayers directly and remove legacy events
The following events are not emitted anymore and replaced with the events from Openlayers.
All new events receive a generic ObjectEvent
.
This means, changing only the event name in your templates isn't enough, you must adopt the implementations of the handler functions, so the will receive an ObjectEvent
as first parameter.
positionChanged
->change:position
speedChanged
->change:speed
headingChanged
->change:heading
altitudeChanged
->change:altitude
altitudeAccuracyChanged
->change:altitudeAccuracy
accuracyGeometryChanged
->change:accuracyGeometry
Please refer to the official Openlayers docs for Geolocation for details of the emitted event data format.
Example
<template>
<!-- ... -->
- <ol-geolocation :projection="projection" @positionChanged="geoLocChange">
+ <ol-geolocation :projection="projection" @change:position="geoLocChange">
<!-- ... -->
</template>
<script setup lang="ts">
+ import type { ObjectEvent } from "ol/Object";
// ...
- function geoLocChange(loc: number[]) {
- view.value?.setCenter(loc);
- }
+ function geoLocChange(loc: ObjectEvent) {
+ view.value?.setCenter(event.target?.getPosition());
+ };
</script>