From cf2e4c990e8c4f0139569dd898436f8682fc5b1e Mon Sep 17 00:00:00 2001 From: Martin Raifer Date: Wed, 9 Aug 2023 18:24:16 +0200 Subject: [PATCH] lint --- css/60_photos.css | 32 ++++++++++++--------------- modules/svg/local_photos.js | 19 ++++------------ modules/ui/sections/photo_overlays.js | 1 - modules/ui/settings/local_photos.js | 17 +++++++------- 4 files changed, 26 insertions(+), 43 deletions(-) diff --git a/css/60_photos.css b/css/60_photos.css index 3c9122315..b5f7957a3 100644 --- a/css/60_photos.css +++ b/css/60_photos.css @@ -489,7 +489,7 @@ label.streetside-hires { margin-right: 20px; } -.preview-local-photos { +.list-local-photos { max-height: 40vh; overflow-y: scroll; overflow-x: auto; @@ -498,16 +498,16 @@ label.streetside-hires { margin-left: -100px; padding-left: 100px; } -.preview-local-photos::-webkit-scrollbar { +.list-local-photos::-webkit-scrollbar { border-left: none; } -.preview-local-photos li { +.list-local-photos li { list-style: none; display: flex; justify-content: space-between; height: 30px; } -.preview-local-photos span.filename { +.list-local-photos span.filename { display: block; width: 100%; white-space: nowrap; @@ -519,39 +519,35 @@ label.streetside-hires { border-left: 1px solid #ccc; border-right: 1px solid #ccc; } -.preview-local-photos li:first-child span.filename { +.list-local-photos li:first-child span.filename { border-top: 1px solid #ccc; border-top-left-radius: 4px; } -.preview-local-photos li:first-child button { +.list-local-photos li:first-child button { border-top: 1px solid #ccc; } -.preview-local-photos li:first-child button.remove { +.list-local-photos li:first-child button.remove { border-top-right-radius: 4px; } -.preview-local-photos li:last-child span.filename { +.list-local-photos li:last-child span.filename { border-bottom-left-radius: 4px; } -.preview-local-photos li:last-child button.remove { +.list-local-photos li:last-child button.remove { border-bottom-right-radius: 4px; } -.preview-local-photos li.invalid span.filename { +.list-local-photos li.invalid span.filename { color: #ccc; } -/*.preview-local-photos li.invalid span.filename::before { - content: "! "; - color: red; -}*/ -.preview-local-photos li.invalid button.zoom-to-data { +.list-local-photos li.invalid button.zoom-to-data { display: none; } -.preview-local-photos li button.no-geolocation { +.list-local-photos li button.no-geolocation { display: none; } -.preview-local-photos li.invalid button.no-geolocation { +.list-local-photos li.invalid button.no-geolocation { display: block; } -.preview-local-photos .placeholder div { +.list-local-photos .placeholder div { display: block; height: 40px; width: 40px; diff --git a/modules/svg/local_photos.js b/modules/svg/local_photos.js index 9812d304b..dd8681c1c 100644 --- a/modules/svg/local_photos.js +++ b/modules/svg/local_photos.js @@ -69,20 +69,9 @@ export function svgLocalPhotos(projection, context, dispatch) { return planePhotoFrame.init(context, viewerEnter) .then(planePhotoFrame => { _photoFrame = planePhotoFrame; - //_photoFrame.event.on('viewerChanged', () => …); }); } - function closePhotoViewer() { - const viewer = context.container().select('.photoviewer'); - if (!viewer.empty()) viewer.datum(null); - - viewer - .classed('hide', true) - .selectAll('.photo-wrapper') - .classed('hide', true); - } - // opens the image at bottom left function click(d3_event, image, zoomTo) { ensureViewerLoaded(context).then(() => { @@ -148,7 +137,7 @@ export function svgLocalPhotos(projection, context, dispatch) { .append('g') .attr('class', 'viewfield-group') .on('mouseenter', (d3_event, d) => setStyles(d)) - .on('mouseleave', (d3_event, d) => setStyles(null)) + .on('mouseleave', () => setStyles(null)) .on('click', click); groupsEnter @@ -235,7 +224,7 @@ export function svgLocalPhotos(projection, context, dispatch) { for (const file of files) { try { - const exifData = await exifr.parse(file); + const exifData = await exifr.parse(file); // eslint-disable-line no-await-in-loop const photo = { id: _idAutoinc++, name: file.name, @@ -249,8 +238,8 @@ export function svgLocalPhotos(projection, context, dispatch) { if (sameName.length === 0) { _photos.push(photo); } else { - const thisContent = await photo.getSrc(); - const sameNameContent = await Promise.allSettled(sameName.map(i => i.getSrc())); + const thisContent = await photo.getSrc(); // eslint-disable-line no-await-in-loop + const sameNameContent = await Promise.allSettled(sameName.map(i => i.getSrc())); // eslint-disable-line no-await-in-loop if (!sameNameContent.some(i => i.value === thisContent)) { _photos.push(photo); } diff --git a/modules/ui/sections/photo_overlays.js b/modules/ui/sections/photo_overlays.js index 04beb8bde..fe76d6dbe 100644 --- a/modules/ui/sections/photo_overlays.js +++ b/modules/ui/sections/photo_overlays.js @@ -398,7 +398,6 @@ export function uiSectionPhotoOverlays(context) { d3_event.preventDefault(); d3_event.stopPropagation(); - //TODO photoLayer.fitZoom(); }) .call(svgIcon('#iD-icon-framed-dot', 'monochrome')); diff --git a/modules/ui/settings/local_photos.js b/modules/ui/settings/local_photos.js index 07c0b834c..1d580e5f1 100644 --- a/modules/ui/settings/local_photos.js +++ b/modules/ui/settings/local_photos.js @@ -1,5 +1,4 @@ import { dispatch as d3_dispatch } from 'd3-dispatch'; -import { select as d3_select } from 'd3-selection'; import { isArray, isNumber } from 'lodash-es'; import { t } from '../../core/localizer'; @@ -49,7 +48,7 @@ export function uiSettingsLocalPhotos(context) { .on('change', function(d3_event) { var files = d3_event.target.files; if (files && files.length) { - previews + photoList .select('ul') .append('li') .classed('placeholder', true) @@ -64,20 +63,20 @@ export function uiSettingsLocalPhotos(context) { .classed('button', true) .call(t.append('local_photos.file.label')); - const previews = modal.select('.modal-section.message-text .local-photos') + const photoList = modal.select('.modal-section.message-text .local-photos') .append('div') .append('div') - .classed('preview-local-photos', true) + .classed('list-local-photos', true); - previews + photoList .append('ul'); - updatePreviews(previews.select('ul')); + updatePhotoList(photoList.select('ul')); - context.layers().on('change', () => updatePreviews(previews.select('ul'))); + context.layers().on('change', () => updatePhotoList(photoList.select('ul'))); } - function updatePreviews(container) { + function updatePhotoList(container) { function locationUnavailable(d) { return !(isArray(d.loc) && isNumber(d.loc[0]) && isNumber(d.loc[1])); } @@ -132,7 +131,7 @@ export function uiSettingsLocalPhotos(context) { selection.select('button.remove') .on('click', (d3_event, d) => { photoLayer.removePhoto(d.id); - updatePreviews(container); + updatePhotoList(container); }); }