()
| 44 | } |
| 45 | |
| 46 | function calculateImagesDataWithClip() |
| 47 | { |
| 48 | imagesDataClip = {}; |
| 49 | |
| 50 | let imageClip = readingImageClip(); |
| 51 | let clipVertical = (imageClip.top + imageClip.bottom) / 100; |
| 52 | let clipHorizontal = (imageClip.left + imageClip.right) / 100; |
| 53 | |
| 54 | if(clipVertical === 0 && clipHorizontal === 0) |
| 55 | return imagesDataClip = imagesData; |
| 56 | |
| 57 | for(let i = 1; i < (contentNum + 1); i++) |
| 58 | { |
| 59 | if(typeof imagesData[i] !== 'undefined') |
| 60 | { |
| 61 | let width = Math.round(imagesData[i].width * (1 - clipHorizontal)); |
| 62 | let height = Math.round(imagesData[i].height * (1 - clipVertical)); |
| 63 | |
| 64 | imagesDataClip[i] = { |
| 65 | width: width, |
| 66 | height: height, |
| 67 | aspectRatio: (width / height), |
| 68 | }; |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | return imagesDataClip; |
| 73 | } |
| 74 | |
| 75 | //Calculates the distribution of the images depending on the user's configuration |
| 76 | function calculateImagesDistribution() |
no test coverage detected