Use 'image' as key for a new image if it is available

This commit is contained in:
Pieter Vander Vennet 2020-07-21 22:40:46 +02:00
parent 6ce60a79b2
commit 1ed9467221

View file

@ -48,12 +48,18 @@ export class OsmImageUploadHandler {
title: title, title: title,
description: description, description: description,
handleURL: function (url) { handleURL: function (url) {
let key = "image";
if (tags["image"] !== undefined) {
let freeIndex = 0; let freeIndex = 0;
while (tags["image:" + freeIndex] !== undefined) { while (tags["image:" + freeIndex] !== undefined) {
freeIndex++; freeIndex++;
} }
console.log("Adding image:" + freeIndex, url); key = "image:" + freeIndex;
changes.addChange(tags.id, "image:" + freeIndex, url); }
console.log("Adding image:" + key, url);
changes.addChange(tags.id, key, url);
self._slideShow.MoveTo(-1); // set the last (thus newly added) image) to view self._slideShow.MoveTo(-1); // set the last (thus newly added) image) to view
}, },
allDone: function () { allDone: function () {