-
Notifications
You must be signed in to change notification settings - Fork 45
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
Not accurate prop type for Marker component #383
Comments
I'm not sure about this. We should support both if we can. When it comes to working with LngLat, it's easy to mix it up. Especially if you wrote application logic that uses the other order arround. At the same time, I dont think it makes sense to send in an object as a prop. |
@Maker-Mark , the point is that mapgox-gl is already accepting An array with two numbers, longitude and latitude, is also a valid value for
(copied from here: https://github.com/mapbox/mapbox-gl-js/blob/50adf1cc14e5aef09099f15c5cb803eaa5f72a48/src/geo/lng_lat.js – repository at version 1.13.1) Is this in harmony with your words ‘we should support both’? |
@karol-bujacek Ahh you're right. We just need to expect a lat lon like type. Not sure where that would go in this repo. |
Current version of VMarker is written corectly: https://github.com/geospoc/v-mapbox/blob/main/types/markers/VMarker.vue.d.ts#L18 |
In the current code the type of
coordinates
prop is set toArray
and this is not correct. Why?Mapbox-gl is accepting for marker coordinates a
LngLatLike
object, which is described as ‘an array of two numbers representing longitude and latitude, or an object with lng and lat or lon and lat properties.’ (cited from https://docs.mapbox.com/mapbox-gl-js/api/geography/#lnglatlike)That mean that v-mapbox code is a far more restricting than the library it is using. This forces us, developers, to convert an object to an array, i.e. to use more primitive attributes than can be used. Especially in the case of longitude and latitude it is error prone – you can easily misorder the coordinates and use
[latitude, longitude]
instead of[longitude, latitude]
(I’ve almost trained myself to check that other location immediately when my markers are not present – then started to use objects instead of arrays every time it is possible :-) ).The text was updated successfully, but these errors were encountered: