Place CR icon correctly on (scaled) image
Also, show "red dot" only if details not viewed already.
This commit is contained in:
parent
28865658d2
commit
c66602deb7
7 changed files with 74 additions and 37 deletions
|
|
@ -109,26 +109,6 @@ $hiliteColor: #4642f1;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
}
|
}
|
||||||
|
|
||||||
.send-attachments__selecting__current-item__preparing {
|
|
||||||
position: absolute;
|
|
||||||
right: 8px;
|
|
||||||
bottom: 4px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: end;
|
|
||||||
justify-content: end;
|
|
||||||
}
|
|
||||||
|
|
||||||
.send-attachments__selecting__current-item__cc {
|
|
||||||
position: absolute;
|
|
||||||
right: 12px;
|
|
||||||
bottom: 12px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: end;
|
|
||||||
justify-content: end;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.file-drop-choose-files {
|
.file-drop-choose-files {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<v-img class="image-with-progress" v-bind="{...$props, ...$attrs}">
|
<resize-observer @notify="handleResize" />
|
||||||
|
<v-img ref="image" class="image-with-progress" v-bind="{...$props, ...$attrs}" v-on:load="loaded">
|
||||||
<LoadProgress class="image-with-progress__progress" v-if="loadingProgress != undefined && loadingProgress >= 0 && loadingProgress < 100" :percentage="loadingProgress" />
|
<LoadProgress class="image-with-progress__progress" v-if="loadingProgress != undefined && loadingProgress >= 0 && loadingProgress < 100" :percentage="loadingProgress" />
|
||||||
</v-img>
|
</v-img>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -12,10 +13,10 @@ import * as sdk from "matrix-js-sdk";
|
||||||
import logoMixin from "./logoMixin";
|
import logoMixin from "./logoMixin";
|
||||||
import LoadProgress from "./LoadProgress.vue";
|
import LoadProgress from "./LoadProgress.vue";
|
||||||
import { VImg } from "vuetify/components/VImg";
|
import { VImg } from "vuetify/components/VImg";
|
||||||
|
import { emit } from "process";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ImageWithProgress",
|
name: "ImageWithProgress",
|
||||||
extends: VImg,
|
|
||||||
components: { LoadProgress },
|
components: { LoadProgress },
|
||||||
props: {
|
props: {
|
||||||
loadingProgress: {
|
loadingProgress: {
|
||||||
|
|
@ -28,6 +29,14 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
|
loaded() {
|
||||||
|
this.$emit('loaded', this.$refs.image);
|
||||||
|
},
|
||||||
|
handleResize() {
|
||||||
|
this.loaded();
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="cc-detail-info" v-if="infoText !== undefined" v-html="infoText" />
|
<div class="cc-detail-info" v-if="infoText !== undefined" v-html="infoText" />
|
||||||
<div class="attachment-info__detail-box" v-if="!showFlagsOnly">
|
<div class="attachment-info__detail-box" v-if="!showFlagsOnly && details.length > 0">
|
||||||
<div class="detail-title">
|
<div class="detail-title">
|
||||||
{{ t("cc.details") }}
|
{{ t("cc.details") }}
|
||||||
<v-icon v-if="hasC2PA">$vuetify.icons.ic_cr</v-icon>
|
<v-icon v-if="hasC2PA">$vuetify.icons.ic_cr</v-icon>
|
||||||
|
|
|
||||||
|
|
@ -24,16 +24,16 @@
|
||||||
<div :class="{ 'send-attachments__selecting__current-item': true, 'drop-target': dropTarget }"
|
<div :class="{ 'send-attachments__selecting__current-item': true, 'drop-target': dropTarget }"
|
||||||
@drop.prevent="filesDropped" @dragover.prevent="dropTarget = true" @dragleave.prevent="dropTarget = false"
|
@drop.prevent="filesDropped" @dragover.prevent="dropTarget = true" @dragleave.prevent="dropTarget = false"
|
||||||
@dragenter.prevent="dropTarget = true">
|
@dragenter.prevent="dropTarget = true">
|
||||||
<ThumbnailView :item="currentAttachment" />
|
<ThumbnailView :item="currentAttachment">
|
||||||
<div v-if="currentAttachment && currentAttachment.status === 'loading'"
|
<template v-slot:decorator v-if="currentAttachment && currentAttachment.status === 'loading'">
|
||||||
class="send-attachments__selecting__current-item__preparing">
|
<div style="font-size: 0.7em; opacity: 0.7">
|
||||||
<div style="font-size: 0.7em; opacity: 0.7">
|
<v-progress-circular indeterminate class="mb-0"></v-progress-circular>
|
||||||
<v-progress-circular indeterminate class="mb-0"></v-progress-circular>
|
</div>
|
||||||
</div>
|
</template>
|
||||||
</div>
|
<template v-slot:decorator v-else-if="showCCIcon">
|
||||||
<div v-else-if="showCCIcon" class="send-attachments__selecting__current-item__cc">
|
<v-icon style="width:24px;height:24px">$vuetify.icons.ic_cr</v-icon>
|
||||||
<v-icon style="width:24px;height:24px">$vuetify.icons.ic_cr</v-icon>
|
</template>
|
||||||
</div>
|
</ThumbnailView>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="file-drop-thumbnail-container">
|
<div class="file-drop-thumbnail-container">
|
||||||
|
|
@ -68,7 +68,7 @@
|
||||||
<v-btn class="send-button clickable" icon="arrow_upward" size="default" elevation="0" color="black"
|
<v-btn class="send-button clickable" icon="arrow_upward" size="default" elevation="0" color="black"
|
||||||
@click.stop="sendAll" :disabled="sendButtonDisabled"></v-btn>
|
@click.stop="sendAll" :disabled="sendButtonDisabled"></v-btn>
|
||||||
</div>
|
</div>
|
||||||
<v-badge location="top right" color="#ff3300" dot class="cc-badge" :model-value="anyContainsCC">
|
<v-badge location="top right" color="#ff3300" dot class="cc-badge" :model-value="showRedDotBadge">
|
||||||
<v-btn class="info-button clickable" icon="$vuetify.icons.ic_share_settings" size="44" elevation="0"
|
<v-btn class="info-button clickable" icon="$vuetify.icons.ic_share_settings" size="44" elevation="0"
|
||||||
color="black" @click.stop="showInformation" :disabled="currentAttachment?.status !== 'loaded'"></v-btn>
|
color="black" @click.stop="showInformation" :disabled="currentAttachment?.status !== 'loaded'"></v-btn>
|
||||||
</v-badge>
|
</v-badge>
|
||||||
|
|
@ -228,11 +228,17 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
},
|
},
|
||||||
anyContainsCC(): boolean {
|
showRedDotBadge(): boolean {
|
||||||
return this.batch.attachments.some((a: Attachment) => a.proof?.integrity?.c2pa !== undefined);
|
return this.currentAttachment && this.currentAttachment.proof?.integrity?.c2pa !== undefined && !this.currentAttachment.detailsViewed;
|
||||||
},
|
},
|
||||||
showCCIcon(): boolean {
|
showCCIcon(): boolean {
|
||||||
return this.currentAttachment && this.currentAttachment.proof?.integrity?.c2pa !== undefined && !this.currentAttachment.useScaled;
|
return this.currentAttachment && this.currentAttachment.proof?.integrity?.c2pa !== undefined && !this.currentAttachment.useScaled;
|
||||||
|
},
|
||||||
|
currentlyViewedItem(): Attachment | undefined {
|
||||||
|
if (this.showAttachmentInformation) {
|
||||||
|
return this.currentAttachment;
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|
@ -247,6 +253,11 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
deep: 1,
|
deep: 1,
|
||||||
},
|
},
|
||||||
|
currentlyViewedItem(newVal) {
|
||||||
|
if (newVal) {
|
||||||
|
newVal.detailsViewed = true; // We have seen this now
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
showInformation() {
|
showInformation() {
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@
|
||||||
:contain="!previewOnly"
|
:contain="!previewOnly"
|
||||||
:cover="previewOnly"
|
:cover="previewOnly"
|
||||||
:loadingProgress="loadingProgress"
|
:loadingProgress="loadingProgress"
|
||||||
|
ref="imageRef"
|
||||||
|
v-on:loaded="imageLoaded"
|
||||||
/>
|
/>
|
||||||
<div v-else :class="{ 'thumbnail-item': true, preview: previewOnly, 'file-item': true, 'pdf-file': isPDF }">
|
<div v-else :class="{ 'thumbnail-item': true, preview: previewOnly, 'file-item': true, 'pdf-file': isPDF }">
|
||||||
<div class="pdf-container" v-if="showInlinePDF && isPDF">
|
<div class="pdf-container" v-if="showInlinePDF && isPDF">
|
||||||
|
|
@ -34,6 +36,10 @@
|
||||||
<div class="file-size">{{ fileSize }}</div>
|
<div class="file-size">{{ fileSize }}</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div :style="decoratorStyle" id="asdi">
|
||||||
|
<slot name="decorator"></slot>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -58,6 +64,7 @@ function isAttachment(source: EventAttachment | Attachment | undefined): source
|
||||||
const $$sanitize: any = inject("globalSanitize");
|
const $$sanitize: any = inject("globalSanitize");
|
||||||
|
|
||||||
const thumbnailRef = useTemplateRef("thumbnailRef");
|
const thumbnailRef = useTemplateRef("thumbnailRef");
|
||||||
|
const imageRef = useTemplateRef("imageRef");
|
||||||
|
|
||||||
interface ThumbnailProps {
|
interface ThumbnailProps {
|
||||||
item?: EventAttachment | Attachment;
|
item?: EventAttachment | Attachment;
|
||||||
|
|
@ -78,6 +85,7 @@ let { isVideo, isImage, fileTypeIcon, fileTypeIconClass, fileName, fileSize, isP
|
||||||
const fileURL: Ref<string | undefined> = ref(undefined);
|
const fileURL: Ref<string | undefined> = ref(undefined);
|
||||||
const source: Ref<string | undefined> = ref(undefined);
|
const source: Ref<string | undefined> = ref(undefined);
|
||||||
const poster: Ref<string | undefined> = ref(undefined);
|
const poster: Ref<string | undefined> = ref(undefined);
|
||||||
|
const decoratorStyle: Ref<string | undefined> = ref(undefined);
|
||||||
|
|
||||||
const updateSource = () => {
|
const updateSource = () => {
|
||||||
if (isEventAttachment(props.item)) {
|
if (isEventAttachment(props.item)) {
|
||||||
|
|
@ -130,6 +138,33 @@ const updatePoster = () => {
|
||||||
updateSource();
|
updateSource();
|
||||||
updatePoster();
|
updatePoster();
|
||||||
|
|
||||||
|
const imageLoaded = (image: any) => {
|
||||||
|
if (imageRef.value) {
|
||||||
|
const rect = image.$el.getBoundingClientRect();
|
||||||
|
const nw = image.naturalWidth;
|
||||||
|
const nh = image.naturalHeight;
|
||||||
|
|
||||||
|
let t = 0;
|
||||||
|
let l = 0;
|
||||||
|
let w = 0;
|
||||||
|
let h = 0;
|
||||||
|
|
||||||
|
const wRatio = rect.width / rect.height;
|
||||||
|
const iRatio = nw / nh;
|
||||||
|
if (iRatio > wRatio) {
|
||||||
|
w = rect.width;
|
||||||
|
h = rect.width / iRatio;
|
||||||
|
} else {
|
||||||
|
w = rect.height * iRatio;
|
||||||
|
h = rect.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
l = (rect.width - w) / 2;
|
||||||
|
t = (rect.height -h) / 2;
|
||||||
|
|
||||||
|
decoratorStyle.value = `position:absolute;top:${t}px;left:${l}px;width:${w}px;height:${h}px;display:flex;align-items:end;justify-content:end;padding:10px`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
watch(props, (props: ThumbnailProps) => {
|
watch(props, (props: ThumbnailProps) => {
|
||||||
const updates = useThumbnail(isEventAttachment(props.item) ? props.item.event : isAttachment(props.item) ? props.item.file : undefined);
|
const updates = useThumbnail(isEventAttachment(props.item) ? props.item.event : isAttachment(props.item) ? props.item.file : undefined);
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@ export type Attachment = {
|
||||||
proof?: Proof;
|
proof?: Proof;
|
||||||
mediaMetadata?: MediaMetadata;
|
mediaMetadata?: MediaMetadata;
|
||||||
thumbnail?: AttachmentThumbnail;
|
thumbnail?: AttachmentThumbnail;
|
||||||
|
detailsViewed: boolean;
|
||||||
sendInfo: AttachmentSendInfo;
|
sendInfo: AttachmentSendInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ export class AttachmentManager {
|
||||||
status: "loading",
|
status: "loading",
|
||||||
file: file,
|
file: file,
|
||||||
useCompressed: false,
|
useCompressed: false,
|
||||||
|
detailsViewed: false,
|
||||||
sendInfo: {
|
sendInfo: {
|
||||||
status: "initial",
|
status: "initial",
|
||||||
statusDate: 0,
|
statusDate: 0,
|
||||||
|
|
@ -438,7 +439,7 @@ export class AttachmentManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const createUploadBatch = (manager: AttachmentManager | null, room: Room | null): AttachmentBatch => {
|
export const createUploadBatch = (manager: AttachmentManager | null, room: KeanuRoom | null): AttachmentBatch => {
|
||||||
const matrixClient = manager?.matrixClient;
|
const matrixClient = manager?.matrixClient;
|
||||||
const maxSizeUploads = manager?.maxSizeUploads ?? 0;
|
const maxSizeUploads = manager?.maxSizeUploads ?? 0;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue