This file contains hidden or 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
imagesArray.forEach(image => { | |
image.image.style.width = `${(rowHeight * image.aspect) * 100 / rowWidth}%`; | |
}); |
This file contains hidden or 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
// Высчитываем ширину ряда что-бы вычислить процентную ширину каждой картинки. | |
const rowWidth = wrap.offsetWidth; | |
// Высчитываем высоту ряда. | |
let rowHeight = rowWidth / aspect - horizontalPadding; | |
if ((rowHeight > maxHeight) && this.totalImages === 1) { | |
rowHeight = maxHeight; | |
} |
This file contains hidden or 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
aspect = aspect + imageAspect; |
This file contains hidden or 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
const imageAspect = imageWidth / imageHeight || 1; |
This file contains hidden or 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
const imageWidth = image.naturalWidth; | |
const imageHeight = image.naturalHeight; |
This file contains hidden or 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
let aspect = 0; // сумма наших соотношений сторон у изображений | |
const horizontalPadding = 5; // отступ у изображений по горизонтали | |
const maxHeight = 500; // максимальная высота изображения, нужно если у нас одно изображение |
This file contains hidden or 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) { | |
const rowArray = Array.from(row); | |
let aspect = 0; | |
const horizontalPadding = 4; | |
const maxHeight = 500; |
This file contains hidden or 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; | |
This file contains hidden or 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
import { NotificationService } from '../../../services/notification/notification.service'; | |
import { SalonsService } from '../../../services/salons/salons.service'; | |
import { User, Salon, Notification } from '../../../../stub'; | |
import { UserService } from '../../../services/user/user.service'; | |
import { Component, OnInit, Output, EventEmitter, Input, ElementRef, NgZone } from '@angular/core'; | |
import { FormControl, FormGroup } from '@angular/forms'; | |
import { BookingService } from '../../../services/booking/booking.service'; | |
import { Subscription } from 'rxjs/Subscription'; | |
@Component({ |