aboutsummaryrefslogtreecommitdiff
path: root/src/component
diff options
context:
space:
mode:
Diffstat (limited to 'src/component')
-rw-r--r--src/component/MosaicBackground.astro7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/component/MosaicBackground.astro b/src/component/MosaicBackground.astro
index d568172..df81a25 100644
--- a/src/component/MosaicBackground.astro
+++ b/src/component/MosaicBackground.astro
@@ -13,8 +13,8 @@ const { height = "400" } = Astro.props;
const children = e.children;
const max = e.clientWidth;
const height = e.getAttribute("data-height");
+ if (height == null) throw new Error(`Height is null`);
const newChildren = [];
- console.log(e.hasAttribute("data-height"));
let line = document.createElement("div");
let currentWidth = 0;
@@ -22,7 +22,6 @@ const { height = "400" } = Astro.props;
const fn = () => {
let current = children[i++];
- console.log(current.getBoundingClientRect().width, current.getBoundingClientRect().height);
let ratio = current.clientWidth / current.clientHeight;
line.appendChild(current.cloneNode(true));
currentWidth += ratio * height;
@@ -33,10 +32,8 @@ const { height = "400" } = Astro.props;
while (i < children.length && currentWidth <= max) fn();
if (i < children.length) fn();
// setting height
- console.log(currentWidth);
let h = (max * height) / currentWidth;
- console.log(`${h}px`);
- line.style.height = `${h - 1}px`;
+ line.style.height = `${h - 0.01}px`;
newChildren.push(line);
if (i < children.length) {
line = document.createElement("div");