Last active
April 28, 2018 14:10
-
-
Save PavelGonzales/b5891fbeeca4e2f517eaa79fc57936ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Метод принимает | |
* @param {array} row // массив картинок в ряду. | |
* @param {HTMLElement} wrap // родитель картинок, наш компонент или блок. | |
**/ | |
function flow(row, wrap) { | |
let aspect = 0; | |
const horizontalPadding = 5; | |
const maxHeight = 500; | |
// Собираем все картинки высчитываем соотношение сторон. | |
const imagesArray = row.map(image => { | |
const imageWidth = image.naturalWidth; | |
const imageHeight = image.naturalHeight; | |
const imageAspect = imageWidth / imageHeight || 1; | |
aspect = aspect + imageAspect; | |
return {image, aspect: imageAspect}; | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment