|
|
@ -718,35 +718,35 @@ export function wrapAlbum({groupID, attachmentDiv, middleware, uploading, lazyLo |
|
|
|
uploading?: boolean, |
|
|
|
uploading?: boolean, |
|
|
|
isOut: boolean |
|
|
|
isOut: boolean |
|
|
|
}) { |
|
|
|
}) { |
|
|
|
let items: {size: MTPhotoSize, media: any, message: any}[] = []; |
|
|
|
const items: {size: MTPhotoSize, media: any, message: any}[] = []; |
|
|
|
|
|
|
|
|
|
|
|
// higher msgID will be the last in album
|
|
|
|
// !higher msgID will be the FIRST in album
|
|
|
|
let storage = appMessagesManager.groupedMessagesStorage[groupID]; |
|
|
|
const storage = Object.keys(appMessagesManager.groupedMessagesStorage[groupID]).map(id => +id).sort((a, b) => a - b); |
|
|
|
for(let mid in storage) { |
|
|
|
for(const mid of storage) { |
|
|
|
let m = appMessagesManager.getMessage(+mid); |
|
|
|
const m = appMessagesManager.getMessage(mid); |
|
|
|
let media = m.media.photo || m.media.document; |
|
|
|
const media = m.media.photo || m.media.document; |
|
|
|
|
|
|
|
|
|
|
|
let size: any = media._ == 'photo' ? appPhotosManager.choosePhotoSize(media, 480, 480) : {w: media.w, h: media.h}; |
|
|
|
const size: any = media._ == 'photo' ? appPhotosManager.choosePhotoSize(media, 480, 480) : {w: media.w, h: media.h}; |
|
|
|
items.push({size, media, message: m}); |
|
|
|
items.push({size, media, message: m}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let spacing = 2; |
|
|
|
const spacing = 2; |
|
|
|
let layouter = new Layouter(items.map(i => ({w: i.size.w, h: i.size.h})), mediaSizes.active.album.width, 100, spacing); |
|
|
|
const layouter = new Layouter(items.map(i => ({w: i.size.w, h: i.size.h})), mediaSizes.active.album.width, 100, spacing); |
|
|
|
let layout = layouter.layout(); |
|
|
|
const layout = layouter.layout(); |
|
|
|
//console.log('layout:', layout, items.map(i => ({w: i.size.w, h: i.size.h})));
|
|
|
|
//console.log('layout:', layout, items.map(i => ({w: i.size.w, h: i.size.h})));
|
|
|
|
|
|
|
|
|
|
|
|
/* let borderRadius = window.getComputedStyle(realParent).getPropertyValue('border-radius'); |
|
|
|
/* let borderRadius = window.getComputedStyle(realParent).getPropertyValue('border-radius'); |
|
|
|
let brSplitted = fillPropertyValue(borderRadius); */ |
|
|
|
let brSplitted = fillPropertyValue(borderRadius); */ |
|
|
|
|
|
|
|
|
|
|
|
for(let {geometry, sides} of layout) { |
|
|
|
for(const {geometry, sides} of layout) { |
|
|
|
let item = items.shift(); |
|
|
|
const item = items.shift(); |
|
|
|
if(!item) { |
|
|
|
if(!item) { |
|
|
|
console.error('no item for layout!'); |
|
|
|
console.error('no item for layout!'); |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let {size, media, message} = item; |
|
|
|
const {size, media, message} = item; |
|
|
|
let div = document.createElement('div'); |
|
|
|
const div = document.createElement('div'); |
|
|
|
div.classList.add('album-item'); |
|
|
|
div.classList.add('album-item'); |
|
|
|
div.dataset.mid = message.mid; |
|
|
|
div.dataset.mid = message.mid; |
|
|
|
|
|
|
|
|
|
|
|