This commit is contained in:
Martin Raifer
2023-08-09 18:24:16 +02:00
parent 4419b36eae
commit cf2e4c990e
4 changed files with 26 additions and 43 deletions

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -398,7 +398,6 @@ export function uiSectionPhotoOverlays(context) {
d3_event.preventDefault();
d3_event.stopPropagation();
//TODO
photoLayer.fitZoom();
})
.call(svgIcon('#iD-icon-framed-dot', 'monochrome'));

View File

@@ -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);
});
}