diff options
author | OzoneGrif | 2020-01-31 02:26:12 +0100 |
---|---|---|
committer | GitHub | 2020-01-31 02:26:12 +0100 |
commit | d94b987463169b254ab69a79ddb58e5beccb0941 (patch) | |
tree | 51f66cdada6a8e920ba80a3aae76393e0127d825 /viewer/src/views | |
parent | 15c806adec22239096a910b92b49fcfb964815bd (diff) | |
parent | 2157b66f3ea43137391939992cac4dc901a4ac4e (diff) | |
download | ldgallery-d94b987463169b254ab69a79ddb58e5beccb0941.tar.gz |
Merge pull request #65 from pacien/oz-viewer
viewer improvements
Diffstat (limited to 'viewer/src/views')
-rw-r--r-- | viewer/src/views/GalleryDirectory.vue | 8 | ||||
-rw-r--r-- | viewer/src/views/GalleryPicture.vue | 4 | ||||
-rw-r--r-- | viewer/src/views/GalleryThumbnail.vue | 12 | ||||
-rw-r--r-- | viewer/src/views/MainGallery.vue (renamed from viewer/src/views/Gallery.vue) | 28 | ||||
-rw-r--r-- | viewer/src/views/MainLayout.vue | 11 | ||||
-rw-r--r-- | viewer/src/views/PanelLeft.vue | 5 | ||||
-rw-r--r-- | viewer/src/views/PanelTop.vue | 78 |
7 files changed, 75 insertions, 71 deletions
diff --git a/viewer/src/views/GalleryDirectory.vue b/viewer/src/views/GalleryDirectory.vue index 1df0c4d..d01032d 100644 --- a/viewer/src/views/GalleryDirectory.vue +++ b/viewer/src/views/GalleryDirectory.vue | |||
@@ -19,7 +19,7 @@ | |||
19 | 19 | ||
20 | <template> | 20 | <template> |
21 | <div class="thumbnail-tiles"> | 21 | <div class="thumbnail-tiles"> |
22 | <div v-for="(item) in directory.properties.items" :key="item.path"> | 22 | <div v-for="(item) in orderedItems" :key="item.path"> |
23 | <router-link :to="item.path"> | 23 | <router-link :to="item.path"> |
24 | <gallery-thumbnail :item="item" /> | 24 | <gallery-thumbnail :item="item" /> |
25 | </router-link> | 25 | </router-link> |
@@ -32,13 +32,19 @@ | |||
32 | 32 | ||
33 | <script lang="ts"> | 33 | <script lang="ts"> |
34 | import { Component, Vue, Prop } from "vue-property-decorator"; | 34 | import { Component, Vue, Prop } from "vue-property-decorator"; |
35 | import Tools from "@/tools"; | ||
35 | import GalleryThumbnail from "./GalleryThumbnail.vue"; | 36 | import GalleryThumbnail from "./GalleryThumbnail.vue"; |
37 | import Gallery from "./Gallery.vue"; | ||
36 | 38 | ||
37 | @Component({ | 39 | @Component({ |
38 | components: { GalleryThumbnail }, | 40 | components: { GalleryThumbnail }, |
39 | }) | 41 | }) |
40 | export default class GalleryDirectory extends Vue { | 42 | export default class GalleryDirectory extends Vue { |
41 | @Prop({ required: true }) readonly directory!: Gallery.Directory; | 43 | @Prop({ required: true }) readonly directory!: Gallery.Directory; |
44 | |||
45 | get orderedItems() { | ||
46 | return Tools.directoriesFirst(this.directory.properties.items); | ||
47 | } | ||
42 | } | 48 | } |
43 | </script> | 49 | </script> |
44 | 50 | ||
diff --git a/viewer/src/views/GalleryPicture.vue b/viewer/src/views/GalleryPicture.vue index 579e74b..323333a 100644 --- a/viewer/src/views/GalleryPicture.vue +++ b/viewer/src/views/GalleryPicture.vue | |||
@@ -25,7 +25,7 @@ | |||
25 | @click="onClick" | 25 | @click="onClick" |
26 | @dragscrollstart="dragging=true" | 26 | @dragscrollstart="dragging=true" |
27 | > | 27 | > |
28 | <img :src="pictureSrc" /> | 28 | <v-lazy-image :src="pictureSrc" /> |
29 | </div> | 29 | </div> |
30 | </template> | 30 | </template> |
31 | 31 | ||
@@ -56,6 +56,7 @@ export default class GalleryPicture extends Vue { | |||
56 | height: 100%; | 56 | height: 100%; |
57 | & > img { | 57 | & > img { |
58 | object-fit: contain; | 58 | object-fit: contain; |
59 | cursor: zoom-in; | ||
59 | } | 60 | } |
60 | } | 61 | } |
61 | .originalSize { | 62 | .originalSize { |
@@ -67,6 +68,7 @@ export default class GalleryPicture extends Vue { | |||
67 | max-width: unset; | 68 | max-width: unset; |
68 | max-height: unset; | 69 | max-height: unset; |
69 | object-fit: none; | 70 | object-fit: none; |
71 | cursor: zoom-out; | ||
70 | } | 72 | } |
71 | } | 73 | } |
72 | </style> | 74 | </style> |
diff --git a/viewer/src/views/GalleryThumbnail.vue b/viewer/src/views/GalleryThumbnail.vue index 7ceea4f..41a59e1 100644 --- a/viewer/src/views/GalleryThumbnail.vue +++ b/viewer/src/views/GalleryThumbnail.vue | |||
@@ -28,8 +28,8 @@ | |||
28 | @load="loading=false" | 28 | @load="loading=false" |
29 | /> | 29 | /> |
30 | <div v-else class="flex-column flex-center"> | 30 | <div v-else class="flex-column flex-center"> |
31 | <fa-icon icon="folder" class="fa-4x" /> | 31 | <fa-icon icon="folder" size="4x" /> |
32 | {{item.path}} | 32 | {{item.title}} |
33 | </div> | 33 | </div> |
34 | </div> | 34 | </div> |
35 | </template> | 35 | </template> |
@@ -57,16 +57,14 @@ export default class GalleryThumbnail extends Vue { | |||
57 | max-height: 250px; | 57 | max-height: 250px; |
58 | } | 58 | } |
59 | .preload { | 59 | .preload { |
60 | background: linear-gradient(to right, rgba(0, 0, 0, 0) 8%, $loader-color 18%, rgba(0, 0, 0, 0) 33%); | 60 | animation: preloadAnimation 1s infinite ease-in-out alternate; |
61 | background-size: 200% 50px; | ||
62 | animation: preloadAnimation 2s infinite linear; | ||
63 | } | 61 | } |
64 | @keyframes preloadAnimation { | 62 | @keyframes preloadAnimation { |
65 | from { | 63 | from { |
66 | background-position: -200px 0; | 64 | background-color: $content-bgcolor; |
67 | } | 65 | } |
68 | to { | 66 | to { |
69 | background-position: 200px 0; | 67 | background-color: $loader-color; |
70 | } | 68 | } |
71 | } | 69 | } |
72 | // Temporary size until we get the true thumbnail size | 70 | // Temporary size until we get the true thumbnail size |
diff --git a/viewer/src/views/Gallery.vue b/viewer/src/views/MainGallery.vue index fad7cc3..06cf512 100644 --- a/viewer/src/views/Gallery.vue +++ b/viewer/src/views/MainGallery.vue | |||
@@ -28,7 +28,8 @@ | |||
28 | 28 | ||
29 | <script lang="ts"> | 29 | <script lang="ts"> |
30 | import { Component, Vue, Prop, Watch } from "vue-property-decorator"; | 30 | import { Component, Vue, Prop, Watch } from "vue-property-decorator"; |
31 | import { Operation } from '@/@types/tag/Operation'; | 31 | import { Operation } from "@/@types/tag/Operation"; |
32 | import Tools from "@/tools"; | ||
32 | import GallerySearch from "./GallerySearch.vue"; | 33 | import GallerySearch from "./GallerySearch.vue"; |
33 | import GalleryDirectory from "./GalleryDirectory.vue"; | 34 | import GalleryDirectory from "./GalleryDirectory.vue"; |
34 | import GalleryPicture from "./GalleryPicture.vue"; | 35 | import GalleryPicture from "./GalleryPicture.vue"; |
@@ -40,7 +41,7 @@ export default class Gallery extends Vue { | |||
40 | @Prop(String) readonly pathMatch!: string; | 41 | @Prop(String) readonly pathMatch!: string; |
41 | 42 | ||
42 | mounted() { | 43 | mounted() { |
43 | this.pathChanged() | 44 | this.pathChanged(); |
44 | } | 45 | } |
45 | 46 | ||
46 | @Watch("pathMatch") | 47 | @Watch("pathMatch") |
@@ -59,14 +60,15 @@ export default class Gallery extends Vue { | |||
59 | 60 | ||
60 | // --- | 61 | // --- |
61 | 62 | ||
62 | private checkType(type: string): boolean { | 63 | private checkType(type: Gallery.ItemType): boolean { |
63 | return this.$galleryStore.currentItem?.properties.type === type ?? false; | 64 | return Tools.checkType(this.$galleryStore.currentItem, type); |
64 | } | 65 | } |
65 | 66 | ||
66 | private extractTagsByOperation(currentTags: Tag.Search[]): Tag.SearchByOperation { | 67 | private extractTagsByOperation(currentTags: Tag.Search[]): Tag.SearchByOperation { |
67 | let byOperation: Tag.SearchByOperation = {}; | 68 | let byOperation: Tag.SearchByOperation = {}; |
68 | Object.values(Operation) | 69 | Object.values(Operation).forEach( |
69 | .forEach(operation => byOperation[operation] = currentTags.filter(tag => tag.operation === operation)); | 70 | operation => (byOperation[operation] = currentTags.filter(tag => tag.operation === operation)) |
71 | ); | ||
70 | return byOperation; | 72 | return byOperation; |
71 | } | 73 | } |
72 | 74 | ||
@@ -75,8 +77,8 @@ export default class Gallery extends Vue { | |||
75 | if (byOperation[Operation.INTERSECTION].length > 0) { | 77 | if (byOperation[Operation.INTERSECTION].length > 0) { |
76 | byOperation[Operation.INTERSECTION] | 78 | byOperation[Operation.INTERSECTION] |
77 | .map(tag => tag.items) | 79 | .map(tag => tag.items) |
78 | .reduce((a,b) => a.filter(c => b.includes(c))) | 80 | .reduce((a, b) => a.filter(c => b.includes(c))) |
79 | .flatMap(items=>items) | 81 | .flatMap(items => items) |
80 | .forEach(item => intersection.add(item)); | 82 | .forEach(item => intersection.add(item)); |
81 | } | 83 | } |
82 | return intersection; | 84 | return intersection; |
@@ -85,14 +87,16 @@ export default class Gallery extends Vue { | |||
85 | private extractSubstraction(byOperation: Tag.SearchByOperation): Set<Gallery.Item> { | 87 | private extractSubstraction(byOperation: Tag.SearchByOperation): Set<Gallery.Item> { |
86 | let substraction = new Set<Gallery.Item>(); | 88 | let substraction = new Set<Gallery.Item>(); |
87 | if (byOperation[Operation.SUBSTRACTION].length > 0) { | 89 | if (byOperation[Operation.SUBSTRACTION].length > 0) { |
88 | byOperation[Operation.SUBSTRACTION] | 90 | byOperation[Operation.SUBSTRACTION].flatMap(tag => tag.items).forEach(item => substraction.add(item)); |
89 | .flatMap(tag => tag.items) | ||
90 | .forEach(item => substraction.add(item)); | ||
91 | } | 91 | } |
92 | return substraction; | 92 | return substraction; |
93 | } | 93 | } |
94 | 94 | ||
95 | private aggregateAll(byOperation: Tag.SearchByOperation, intersection: Set<Gallery.Item>, substraction: Set<Gallery.Item>): Gallery.Item[] { | 95 | private aggregateAll( |
96 | byOperation: Tag.SearchByOperation, | ||
97 | intersection: Set<Gallery.Item>, | ||
98 | substraction: Set<Gallery.Item> | ||
99 | ): Gallery.Item[] { | ||
96 | byOperation[Operation.ADDITION].flatMap(tag => tag.items).forEach(item => intersection.add(item)); | 100 | byOperation[Operation.ADDITION].flatMap(tag => tag.items).forEach(item => intersection.add(item)); |
97 | substraction.forEach(item => intersection.delete(item)); | 101 | substraction.forEach(item => intersection.delete(item)); |
98 | return [...intersection]; | 102 | return [...intersection]; |
diff --git a/viewer/src/views/MainLayout.vue b/viewer/src/views/MainLayout.vue index 7a75eb1..f0809b6 100644 --- a/viewer/src/views/MainLayout.vue +++ b/viewer/src/views/MainLayout.vue | |||
@@ -19,10 +19,11 @@ | |||
19 | 19 | ||
20 | <template> | 20 | <template> |
21 | <div :class="{fullscreen: $uiStore.fullscreen}"> | 21 | <div :class="{fullscreen: $uiStore.fullscreen}"> |
22 | <panel-top class="layout layout-top" /> | 22 | <panel-top v-if="!isLoading" class="layout layout-top" /> |
23 | <panel-left class="layout layout-left" /> | 23 | <panel-left v-if="!isLoading" class="layout layout-left" /> |
24 | <router-view class="layout layout-content scrollbar" /> | 24 | <router-view v-if="!isLoading" class="layout layout-content scrollbar" /> |
25 | <b-loading :active="isLoading" is-full-page /> | 25 | <b-loading :active="isLoading" is-full-page /> |
26 | <ld-key-press :keycode="27" @action="$uiStore.fullscreen=false" /> | ||
26 | </div> | 27 | </div> |