Commit 4fd83b00 authored by Adrien Pavie's avatar Adrien Pavie

Add mapillary shown image to selected features button created

parent ca87dc1f
......@@ -5,7 +5,6 @@ List of features to implement in the future, ordered by priority.
* Vertical passages (stairs, elevators, conveying stairs)
## UI
* Add currently shown Mapillary image key to currently selected feature
* Links to OpenLevelUp
## Fields
......
......@@ -695,11 +695,8 @@ button.save.has-count .count::before {
top: 0;
}
.mapillary-image .mapillary-img-key {
position: absolute;
left: 0;
top: 0;
padding: 5px 10px;
.mapillary-image button.add {
left: 0;
}
.feature-list-pane .inspector-body {
......
......@@ -427,6 +427,7 @@ en:
title: "Traffic Sign Overlay (Mapillary)"
mapillary:
view_on_mapillary: "View this image on Mapillary"
define_for_selection: "Define as image for selected features"
help:
title: "Help"
help: |
......
......@@ -515,7 +515,8 @@
"title": "Traffic Sign Overlay (Mapillary)"
},
"mapillary": {
"view_on_mapillary": "View this image on Mapillary"
"view_on_mapillary": "View this image on Mapillary",
"define_for_selection": "Define as image for selected features"
},
"help": {
"title": "Help",
......
......@@ -192,7 +192,7 @@ iD.services.mapillary = function() {
return iD.services.mapillary.sign_defs[country][type];
};
mapillary.showThumbnail = function(imageKey, position) {
mapillary.showThumbnail = function(imageKey, position, context) {
if (!imageKey) return;
var positionClass = {
......@@ -207,8 +207,14 @@ iD.services.mapillary = function() {
var enter = thumbnail.enter().append('div')
.attr('class', 'mapillary-image ar');
enter.append('div')
.attr('class', 'fillD mapillary-img-key');
enter.append('button')
.attr('class', 'add')
.attr('title', t('mapillary.define_for_selection'))
.on('click', function () {
mapillary.setImageForSelection(context);
})
.append('div')
.call(iD.svg.Icon('#icon-plus'));
enter.append('button')
.on('click', function () {
......@@ -230,9 +236,6 @@ iD.services.mapillary = function() {
thumbnail.selectAll('img')
.attr('src', urlThumb + imageKey + '/thumb-320.jpg');
thumbnail.selectAll('.mapillary-img-key')
.text(imageKey);
var link = thumbnail.selectAll('a')
.attr('href', urlImage + imageKey);
......@@ -281,6 +284,15 @@ iD.services.mapillary = function() {
return mapillary;
};
mapillary.setImageForSelection = function(context) {
var selection = context.selectedIDs();
for(var i=0; i < selection.length; i++) {
var newTags = _.clone(context.entity(selection[i]).tags);
newTags.mapillary = iD.services.mapillary.thumb.key;
context.perform(iD.actions.ChangeTags(selection[i], newTags), t('operations.change_tags.annotation'));
}
};
if (!iD.services.mapillary.cache) {
......
......@@ -34,7 +34,7 @@ iD.svg.MapillaryImages = function(projection, context, dispatch) {
.classed('selected', function(d) { return d.key === thumb.key; });
}
mapillary.showThumbnail(image.key, position);
mapillary.showThumbnail(image.key, position, context);
}
function hideThumbnail() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment