Fix selecting
parent
34dd6a2468
commit
961b867c08
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="photo-container" :class="{ 'selected': data.selected }">
|
<div class="photo-container" :class="{ 'selected': selected }">
|
||||||
<div class="icon-checkmark select" v-if="!data.ph" @click="toggleSelect"></div>
|
<div class="icon-checkmark select" v-if="!data.ph" @click="toggleSelect"></div>
|
||||||
|
|
||||||
<div v-if="data.isvideo" class="icon-video-white"></div>
|
<div v-if="data.isvideo" class="icon-video-white"></div>
|
||||||
|
@ -36,6 +36,10 @@ export default {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
|
selected: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** Passthrough */
|
/** Passthrough */
|
||||||
|
@ -142,9 +146,7 @@ export default {
|
||||||
if (this.data.ph) {
|
if (this.data.ph) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$emit('select', this.data);
|
this.$emit('select', this.data);
|
||||||
this.$forceUpdate();
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,11 +20,12 @@
|
||||||
class="photo-row"
|
class="photo-row"
|
||||||
v-bind:style="{ height: rowHeight + 'px' }">
|
v-bind:style="{ height: rowHeight + 'px' }">
|
||||||
|
|
||||||
<div class="photo" v-for="photo of item.photos">
|
<div class="photo" v-for="photo of item.photos" :key="photo.fileid">
|
||||||
<Folder v-if="photo.is_folder"
|
<Folder v-if="photo.is_folder"
|
||||||
:data="photo" :rowHeight="rowHeight" />
|
:data="photo" :rowHeight="rowHeight" />
|
||||||
<Photo v-else
|
<Photo v-else
|
||||||
:data="photo" :rowHeight="rowHeight" :day="item.day"
|
:data="photo" :rowHeight="rowHeight" :day="item.day"
|
||||||
|
:selected="photo.s || false"
|
||||||
@select="selectPhoto"
|
@select="selectPhoto"
|
||||||
@reprocess="processDay"
|
@reprocess="processDay"
|
||||||
@clickImg="clickPhoto" />
|
@clickImg="clickPhoto" />
|
||||||
|
@ -59,7 +60,12 @@
|
||||||
|
|
||||||
<!-- Top bar for selections etc -->
|
<!-- Top bar for selections etc -->
|
||||||
<div v-if="selection.size > 0" class="top-bar">
|
<div v-if="selection.size > 0" class="top-bar">
|
||||||
{{ selection.size }} items selected
|
<button class="btn icon icon-close" @click="clearSelection"></button>
|
||||||
|
<div class="text">
|
||||||
|
{{ selection.size }} items selected
|
||||||
|
</div>
|
||||||
|
<button class="btn icon icon-download"></button>
|
||||||
|
<button class="btn icon icon-delete"></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -154,6 +160,7 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
/** Reset all state */
|
/** Reset all state */
|
||||||
resetState() {
|
resetState() {
|
||||||
|
this.clearSelection();
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.list = [];
|
this.list = [];
|
||||||
this.numRows = 0;
|
this.numRows = 0;
|
||||||
|
@ -533,7 +540,9 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the photo to the row
|
// Add the photo to the row
|
||||||
this.list[rowIdx].photos.push(data[dataIdx]);
|
const photo = data[dataIdx];
|
||||||
|
photo.s = false; // selected
|
||||||
|
this.list[rowIdx].photos.push(photo);
|
||||||
dataIdx++;
|
dataIdx++;
|
||||||
|
|
||||||
// Add row to day
|
// Add row to day
|
||||||
|
@ -645,14 +654,23 @@ export default {
|
||||||
|
|
||||||
/** Add a photo to selection list */
|
/** Add a photo to selection list */
|
||||||
selectPhoto(photo) {
|
selectPhoto(photo) {
|
||||||
photo.selected = !this.selection.has(photo.fileid) || undefined;
|
photo.s = !this.selection.has(photo);
|
||||||
if (photo.selected) {
|
if (photo.s) {
|
||||||
this.selection.add(photo.fileid);
|
this.selection.add(photo);
|
||||||
} else {
|
} else {
|
||||||
this.selection.delete(photo.fileid);
|
this.selection.delete(photo);
|
||||||
}
|
}
|
||||||
this.$forceUpdate();
|
this.$forceUpdate();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/** Clear all selected photos */
|
||||||
|
clearSelection() {
|
||||||
|
for (const photo of this.selection) {
|
||||||
|
photo.s = false;
|
||||||
|
}
|
||||||
|
this.selection.clear();
|
||||||
|
this.$forceUpdate();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -750,20 +768,33 @@ export default {
|
||||||
/** Top bar */
|
/** Top bar */
|
||||||
.top-bar {
|
.top-bar {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 10px; right: 15px;
|
top: 10px; right: 60px;
|
||||||
padding: 15px;
|
padding: 8px;
|
||||||
width: 400px;
|
width: 400px;
|
||||||
max-width: calc(100vw - 30px);
|
max-width: calc(100vw - 30px);
|
||||||
background-color: var(--color-main-background);
|
background-color: var(--color-main-background);
|
||||||
box-shadow: 0 0 2px gray;
|
box-shadow: 0 0 2px gray;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
opacity: 0.95;
|
opacity: 0.95;
|
||||||
|
display: flex;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
.top-bar .text {
|
||||||
|
flex-grow: 1;
|
||||||
|
line-height: 36px;
|
||||||
|
padding-left: 8px;
|
||||||
|
}
|
||||||
|
.top-bar .btn {
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 3px;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mobile layout */
|
/* Mobile layout */
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.top-bar {
|
.top-bar {
|
||||||
top: 35px;
|
top: 35px;
|
||||||
|
right: 15px;
|
||||||
}
|
}
|
||||||
.timeline-scroll .tick {
|
.timeline-scroll .tick {
|
||||||
background-color: var(--color-main-background);
|
background-color: var(--color-main-background);
|
||||||
|
|
Loading…
Reference in New Issue