You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So if my understanding of javascript is correct you need to use the fields from the class, not from the instance. So your example
function addClickEventListenerToMap(map) {
// add 'tap' listener
map.addEventListener('tap', function (evt) {
var coords = map.screenToGeo(evt.currentPointer.viewportX, evt.currentPointer.viewportY);
findNearestMarker(coords);
}, false);
}
would not work, instead it would have to be
function addClickEventListenerToMap(map) {
// add 'tap' listener
map.addEventListener('tap', function (evt) {
var coords = map.screenToGeo(H.mapevents.Pointer.viewportX, H.mapevents.Pointer.viewportY);
findNearestMarker(coords);
}, false);
}
Reality shows that your implementation works while mine doesn't. So to my understanding your documentation is not correct. This in itself is not a problem, but the typescript implementation of the project is based on the documentation: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/heremaps/index.d.ts
So actually using typescript doesn't work here. So I'd like to change the typescript definition, but for that PR to go through I think you have to change your documentation first.
The text was updated successfully, but these errors were encountered:
Dear Everyone
I have a problem getting your example to work if I use typescript. Actually the typescript definition on https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/heremaps/index.d.ts seems to be wrong. But it follows your documentation, so I actually think your documentation is wrong. Or your actual implementation deviates from the documentation.
Documentation I am referring to: https://developer.here.com/documentation/maps/topics_api/h-mapevents-pointer.html#h-mapevents-pointer
I am implementing the very simple example from https://github.com/heremaps/maps-api-for-javascript-examples/blob/8712f6b62b6e87fa3fa3b43fbf32cf0783f6e90a/finding-the-nearest-marker/js/app.js
I don't follow your example but your documentation. According to https://developer.here.com/documentation/maps/topics_api/h-mapevents-pointer.html#h-mapevents-pointer viewportX and viewportY are static variables.
So if my understanding of javascript is correct you need to use the fields from the class, not from the instance. So your example
would not work, instead it would have to be
Reality shows that your implementation works while mine doesn't. So to my understanding your documentation is not correct. This in itself is not a problem, but the typescript implementation of the project is based on the documentation:
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/heremaps/index.d.ts
So actually using typescript doesn't work here. So I'd like to change the typescript definition, but for that PR to go through I think you have to change your documentation first.
The text was updated successfully, but these errors were encountered: