mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-28 10:51:45 +02:00
add proper local photo strings, enable layer switcher checkbox
This commit is contained in:
@@ -340,11 +340,13 @@ export function uiSectionPhotoOverlays(context) {
|
||||
}
|
||||
|
||||
function drawLocalPhotos(selection) {
|
||||
var dataLayer = layers.layer('local-photos');
|
||||
var photoLayer = layers.layer('local-photos');
|
||||
var hasData = photoLayer && photoLayer.hasData();
|
||||
var showsData = hasData && photoLayer.enabled();
|
||||
|
||||
var ul = selection
|
||||
.selectAll('.layer-list-local-photos')
|
||||
.data(dataLayer ? [0] : []);
|
||||
.data(photoLayer ? [0] : []);
|
||||
|
||||
// Exit
|
||||
ul.exit()
|
||||
@@ -360,24 +362,22 @@ export function uiSectionPhotoOverlays(context) {
|
||||
.attr('class', 'list-item-local-photos');
|
||||
|
||||
var localPhotosLabelEnter = localPhotosEnter
|
||||
.append('label');
|
||||
// TODO: Add tooltip
|
||||
|
||||
// TODO
|
||||
// localPhotosLabelEnter
|
||||
// .append('input')
|
||||
// .attr('type', 'checkbox')
|
||||
// .on('change', function() { toggleLayer('local-photos'); });
|
||||
.append('label')
|
||||
.call(uiTooltip().title(() => t.append('local_photos.tooltip')));
|
||||
|
||||
localPhotosLabelEnter
|
||||
.append('span')
|
||||
.text('Local Photos');
|
||||
.append('input')
|
||||
.attr('type', 'checkbox')
|
||||
.on('change', function() { toggleLayer('local-photos'); });
|
||||
|
||||
localPhotosLabelEnter
|
||||
.call(t.append('local_photos.header'));
|
||||
|
||||
localPhotosEnter
|
||||
.append('button')
|
||||
.attr('class', 'open-data-options')
|
||||
.call(uiTooltip()
|
||||
.title(t.html('settings.custom_data.tooltip'))
|
||||
.title(() => t.append('local_photos.tooltip_edit'))
|
||||
.placement((localizer.textDirection() === 'rtl') ? 'right' : 'left')
|
||||
)
|
||||
.on('click', function(d3_event) {
|
||||
@@ -390,7 +390,7 @@ export function uiSectionPhotoOverlays(context) {
|
||||
.append('button')
|
||||
.attr('class', 'zoom-to-data')
|
||||
.call(uiTooltip()
|
||||
.title(t.html('map_data.layers.custom.zoom'))
|
||||
.title(() => t.append('map_data.layers.custom.zoom'))
|
||||
.placement((localizer.textDirection() === 'rtl') ? 'right' : 'left')
|
||||
)
|
||||
.on('click', function(d3_event) {
|
||||
@@ -399,7 +399,7 @@ export function uiSectionPhotoOverlays(context) {
|
||||
d3_event.preventDefault();
|
||||
d3_event.stopPropagation();
|
||||
//TODO
|
||||
dataLayer.fitZoom();
|
||||
photoLayer.fitZoom();
|
||||
})
|
||||
.call(svgIcon('#iD-icon-framed-dot', 'monochrome'));
|
||||
|
||||
@@ -407,6 +407,16 @@ export function uiSectionPhotoOverlays(context) {
|
||||
ul = ul
|
||||
.merge(ulEnter);
|
||||
|
||||
ul.selectAll('.list-item-local-photos')
|
||||
.classed('active', showsData)
|
||||
.selectAll('label')
|
||||
.classed('deemphasize', !hasData)
|
||||
.selectAll('input')
|
||||
.property('disabled', !hasData)
|
||||
.property('checked', showsData);
|
||||
|
||||
ul.selectAll('button.zoom-to-data')
|
||||
.classed('disabled', !hasData);
|
||||
}
|
||||
|
||||
function editLocalPhotos() {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { dispatch as d3_dispatch } from 'd3-dispatch';
|
||||
|
||||
import { prefs } from '../../core/preferences';
|
||||
import { t } from '../../core/localizer';
|
||||
import { uiConfirm } from '../confirm';
|
||||
import { utilRebind } from '../../util';
|
||||
@@ -12,14 +11,8 @@ export function uiSettingsLocalPhotos(context) {
|
||||
function render(selection) {
|
||||
var dataLayer = context.layers().layer('local-photos');
|
||||
|
||||
// keep separate copies of original and current settings
|
||||
var _origSettings = {
|
||||
fileList: (dataLayer && dataLayer.fileList()) || null,
|
||||
url: prefs('settings-custom-data-url')
|
||||
};
|
||||
var _currSettings = {
|
||||
fileList: (dataLayer && dataLayer.fileList()) || null,
|
||||
url: prefs('settings-custom-data-url')
|
||||
fileList: (dataLayer && dataLayer.fileList()) || null
|
||||
};
|
||||
|
||||
// var example = 'https://{switch:a,b,c}.tile.openstreetmap.org/{zoom}/{x}/{y}.png';
|
||||
@@ -30,17 +23,15 @@ export function uiSettingsLocalPhotos(context) {
|
||||
|
||||
modal.select('.modal-section.header')
|
||||
.append('h3')
|
||||
.call(t.append('settings.custom_data.header'));
|
||||
.call(t.append('local_photos.header'));
|
||||
|
||||
|
||||
var textSection = modal.select('.modal-section.message-text');
|
||||
|
||||
//TODO: Add translation
|
||||
textSection
|
||||
.append('pre')
|
||||
.text('Choose local photos');
|
||||
// .attr('class', 'instructions-file')
|
||||
// .call(t.append('settings.custom_data.file.instructions'));
|
||||
.attr('class', 'instructions-local-photos')
|
||||
.call(t.append('local_photos.file.instructions'));
|
||||
|
||||
textSection
|
||||
.append('input')
|
||||
@@ -52,8 +43,6 @@ export function uiSettingsLocalPhotos(context) {
|
||||
.on('change', function(d3_event) {
|
||||
var files = d3_event.target.files;
|
||||
if (files && files.length) {
|
||||
// _currSettings.url = '';
|
||||
// textSection.select('.field-url').property('value', '');
|
||||
_currSettings.fileList = files;
|
||||
} else {
|
||||
_currSettings.fileList = null;
|
||||
@@ -83,23 +72,12 @@ export function uiSettingsLocalPhotos(context) {
|
||||
}
|
||||
|
||||
|
||||
// restore the original url
|
||||
function clickCancel() {
|
||||
textSection.select('.field-url').property('value', _origSettings.url);
|
||||
prefs('settings-custom-data-url', _origSettings.url);
|
||||
this.blur();
|
||||
modal.close();
|
||||
}
|
||||
|
||||
// accept the current url
|
||||
function clickSave() {
|
||||
// _currSettings.url = textSection.select('.field-url').property('value').trim();
|
||||
|
||||
// one or the other but not both
|
||||
// if (_currSettings.url) { _currSettings.fileList = null; }
|
||||
if (_currSettings.fileList) { _currSettings.url = ''; }
|
||||
|
||||
// prefs('settings-custom-data-url', _currSettings.url);
|
||||
this.blur();
|
||||
modal.close();
|
||||
dispatch.call('change', this, _currSettings);
|
||||
|
||||
Reference in New Issue
Block a user