Browse Source

Fix resolution for reply image

master
morethanwords 4 years ago
parent
commit
632e7eacf6
  1. 19
      src/components/chat/replyContainer.ts
  2. 2
      src/components/poll.ts
  3. 2
      src/scss/partials/_chat.scss

19
src/components/chat/replyContainer.ts

@ -30,17 +30,20 @@ export default class ReplyContainer extends DivAndCaption<(title: string, subtit @@ -30,17 +30,20 @@ export default class ReplyContainer extends DivAndCaption<(title: string, subtit
//console.log('wrap reply', media);
if(media.photo || (media.document && ['video'].indexOf(media.document.type) !== -1)) {
let replyMedia = document.createElement('div');
const replyMedia = document.createElement('div');
replyMedia.classList.add(this.className + '-media');
let photo = media.photo || media.document;
let sizes = photo.sizes || photo.thumbs;
if(sizes && sizes[0].bytes) {
appPhotosManager.setAttachmentPreview(sizes[0].bytes, replyMedia, false, true);
const photo = media.photo || media.document;
if(photo._ == 'document' || !photo.downloaded) {
const sizes = photo.sizes || photo.thumbs;
if(sizes && sizes[0].bytes) {
appPhotosManager.setAttachmentPreview(sizes[0].bytes, replyMedia, false, true);
}
}
appPhotosManager.preloadPhoto(photo, appPhotosManager.choosePhotoSize(photo, 32, 32))
const size = appPhotosManager.choosePhotoSize(photo, 32, 32/* mediaSizes.active.regular.width, mediaSizes.active.regular.height */);
appPhotosManager.preloadPhoto(photo, size)
.then(() => {
renderImageFromUrl(replyMedia, photo._ == 'photo' ? photo.url : appPhotosManager.getDocumentCachedThumb(photo.id).url);
});

2
src/components/poll.ts

@ -380,7 +380,7 @@ export default class PollElement extends HTMLElement { @@ -380,7 +380,7 @@ export default class PollElement extends HTMLElement {
attributeChangedCallback(name: string, oldValue: string, newValue: string) {
// вызывается при изменении одного из перечисленных выше атрибутов
console.log('Poll: attributeChangedCallback', name, oldValue, newValue, this.isConnected);
// console.log('Poll: attributeChangedCallback', name, oldValue, newValue, this.isConnected);
if(name == 'poll-id') {
this.pollID = newValue;
} else if(name == 'message-id') {

2
src/scss/partials/_chat.scss

@ -1225,7 +1225,7 @@ @@ -1225,7 +1225,7 @@
display: flex;
width: 100%;
justify-content: center;
z-index: 5;
//z-index: 5;
top: 8px;
align-items: center;
transform: translate3d(0, calc(-100% - 10px), 0);

Loading…
Cancel
Save