Fix inconsistent state with facerect
parent
b26abaf8b1
commit
c9119a3c72
|
@ -241,7 +241,13 @@ export default class SelectionManager extends Mixins(GlobalMixin, UserConfig) {
|
||||||
this.selection.set(photo.fileid, photo);
|
this.selection.set(photo.fileid, photo);
|
||||||
} else {
|
} else {
|
||||||
photo.flag &= ~this.c.FLAG_SELECTED;
|
photo.flag &= ~this.c.FLAG_SELECTED;
|
||||||
this.selection.delete(photo.fileid);
|
|
||||||
|
// Only do this if the photo in the selection set is this one.
|
||||||
|
// The problem arises when there are duplicates (e.g. face rect)
|
||||||
|
// in the list, which creates an inconsistent state if we do this.
|
||||||
|
if (this.selection.get(photo.fileid) === photo) {
|
||||||
|
this.selection.delete(photo.fileid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!noUpdate) {
|
if (!noUpdate) {
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
<div
|
<div
|
||||||
class="photo"
|
class="photo"
|
||||||
v-for="photo of item.photos"
|
v-for="photo of item.photos"
|
||||||
:key="photo.fileid"
|
:key="photo.key || photo.fileid"
|
||||||
:style="{
|
:style="{
|
||||||
height: photo.dispH + 'px',
|
height: photo.dispH + 'px',
|
||||||
width: photo.dispW + 'px',
|
width: photo.dispW + 'px',
|
||||||
|
@ -930,6 +930,9 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) {
|
||||||
let rowIdx = headIdx + 1;
|
let rowIdx = headIdx + 1;
|
||||||
let rowY = headY + head.size;
|
let rowY = headY + head.size;
|
||||||
|
|
||||||
|
// Duplicate detection, e.g. for face rects
|
||||||
|
const seen = new Map<number, number>();
|
||||||
|
|
||||||
// Previous justified row
|
// Previous justified row
|
||||||
let prevJustifyTop = justify[0]?.top || 0;
|
let prevJustifyTop = justify[0]?.top || 0;
|
||||||
|
|
||||||
|
@ -1016,6 +1019,18 @@ export default class Timeline extends Mixins(GlobalMixin, UserConfig) {
|
||||||
// Move to next index of photo
|
// Move to next index of photo
|
||||||
dataIdx++;
|
dataIdx++;
|
||||||
|
|
||||||
|
// Duplicate detection.
|
||||||
|
// These may be valid, e.g. in face rects. All we need to have
|
||||||
|
// is a unique Vue key for the v-for loop.
|
||||||
|
if (seen.has(photo.fileid)) {
|
||||||
|
const val = seen.get(photo.fileid);
|
||||||
|
photo.key = `${photo.fileid}-${val}`;
|
||||||
|
seen.set(photo.fileid, val + 1);
|
||||||
|
} else {
|
||||||
|
photo.key = null;
|
||||||
|
seen.set(photo.fileid, 1);
|
||||||
|
}
|
||||||
|
|
||||||
// Add photo to row
|
// Add photo to row
|
||||||
row.photos.push(photo);
|
row.photos.push(photo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,8 @@ export type IDay = {
|
||||||
export type IPhoto = {
|
export type IPhoto = {
|
||||||
/** Nextcloud ID of file */
|
/** Nextcloud ID of file */
|
||||||
fileid: number;
|
fileid: number;
|
||||||
|
/** Vue key if duplicates present (otherwise use fileid) */
|
||||||
|
key?: string;
|
||||||
/** Etag from server */
|
/** Etag from server */
|
||||||
etag?: string;
|
etag?: string;
|
||||||
/** Path to file */
|
/** Path to file */
|
||||||
|
|
Loading…
Reference in New Issue