MCPcopy
hub / github.com/ollm/OpenComic / calculateImagesDataWithClip

Function calculateImagesDataWithClip

scripts/reading.js:46–73  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

44}
45
46function 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
76function calculateImagesDistribution()

Callers 1

addHtmlImagesFunction · 0.85

Calls 1

readingImageClipFunction · 0.85

Tested by

no test coverage detected