Move new note marker to click location
If not done, it's possible to lose the marker when starting from low zooms.
This commit is contained in:
parent
5603309026
commit
27aa2ed591
1 changed files with 8 additions and 0 deletions
|
@ -107,6 +107,12 @@ OSM.NewNote = function (map) {
|
||||||
newNoteMarker = null;
|
newNoteMarker = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function moveNewNotMarkerToClick(e) {
|
||||||
|
if (newNoteMarker) newNoteMarker.setLatLng(e.latlng);
|
||||||
|
if (halo) halo.setLatLng(e.latlng);
|
||||||
|
content.find("textarea").focus();
|
||||||
|
}
|
||||||
|
|
||||||
function updateControls() {
|
function updateControls() {
|
||||||
const zoomedOut = addNoteButton.hasClass("disabled");
|
const zoomedOut = addNoteButton.hasClass("disabled");
|
||||||
const withoutText = content.find("textarea").val() === "";
|
const withoutText = content.find("textarea").val() === "";
|
||||||
|
@ -162,6 +168,7 @@ OSM.NewNote = function (map) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
map.on("click", moveNewNotMarkerToClick);
|
||||||
addNoteButton.on("disabled enabled", updateControls);
|
addNoteButton.on("disabled enabled", updateControls);
|
||||||
updateControls();
|
updateControls();
|
||||||
|
|
||||||
|
@ -169,6 +176,7 @@ OSM.NewNote = function (map) {
|
||||||
};
|
};
|
||||||
|
|
||||||
page.unload = function () {
|
page.unload = function () {
|
||||||
|
map.off("click", moveNewNotMarkerToClick);
|
||||||
addNoteButton.off("disabled enabled", updateControls);
|
addNoteButton.off("disabled enabled", updateControls);
|
||||||
removeNewNoteMarker();
|
removeNewNoteMarker();
|
||||||
addNoteButton.removeClass("active");
|
addNoteButton.removeClass("active");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue