Pass location instead of marker to createNote()
This commit is contained in:
parent
954eafd424
commit
9d8ca8be11
1 changed files with 6 additions and 7 deletions
|
@ -35,12 +35,7 @@ OSM.NewNote = function (map) {
|
|||
OSM.router.route("/note/new");
|
||||
});
|
||||
|
||||
function createNote(marker, text, callback) {
|
||||
var location = marker.getLatLng().wrap();
|
||||
|
||||
marker.options.draggable = false;
|
||||
marker.dragging.disable();
|
||||
|
||||
function createNote(location, text, callback) {
|
||||
$.ajax({
|
||||
url: "/api/0.6/notes.json",
|
||||
type: "POST",
|
||||
|
@ -139,11 +134,15 @@ OSM.NewNote = function (map) {
|
|||
}
|
||||
|
||||
content.find("input[type=submit]").on("click", function (e) {
|
||||
const location = newNoteMarker.getLatLng().wrap();
|
||||
const text = content.find("textarea").val();
|
||||
|
||||
e.preventDefault();
|
||||
$(this).prop("disabled", true);
|
||||
createNote(newNoteMarker, text, (feature) => {
|
||||
newNoteMarker.options.draggable = false;
|
||||
newNoteMarker.dragging.disable();
|
||||
|
||||
createNote(location, text, (feature) => {
|
||||
content.find("textarea").val("");
|
||||
updateMarker(feature);
|
||||
noteLayer.removeLayer(newNoteMarker);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue