Remove console logs, fix up down scaling
This commit is contained in:
parent
9752867dd4
commit
581fc9ff69
|
|
@ -48,32 +48,20 @@ const updateDimensions = () => {
|
|||
height.value = clientHeight;
|
||||
}
|
||||
calculateBackgroundHeight();
|
||||
console.log('sizes ', width.value, height.value);
|
||||
};
|
||||
|
||||
const calculateBackgroundHeight = () => {
|
||||
// calculate the hight of the background so, that you see a gray box of correct height before image is loaded
|
||||
console.log('calculateBackgrondHeight');
|
||||
if (width.value) {
|
||||
const scalingFactor = width.value / props.originalWidth;
|
||||
scaledHeight.value = Math.round(props.originalHeight * scalingFactor);
|
||||
|
||||
if (height.value > 3 && height.value < scaledHeight.value && imgElement.value) {
|
||||
// if parents height is limited and smaller than the scaled height
|
||||
const { clientHeight } = imgElement.value.parentElement;
|
||||
backgroundHeight.value = `${clientHeight}px`;
|
||||
console.log('calculateBackgrondHeight a', backgroundHeight.value);
|
||||
return;
|
||||
}
|
||||
|
||||
if (width.value) {
|
||||
backgroundHeight.value = `${scaledHeight.value}px`;
|
||||
console.log('calculateBackgrondHeight b ', backgroundHeight.value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
backgroundHeight.value = '100%';
|
||||
console.log('calculateBackgrondHeight c', backgroundHeight.value);
|
||||
};
|
||||
|
||||
const handleLoad = () => {
|
||||
|
|
@ -111,8 +99,10 @@ onBeforeUnmount(() => {
|
|||
|
||||
.wagtail-image {
|
||||
overflow: hidden;
|
||||
height: 100%;
|
||||
|
||||
&__background {
|
||||
max-height: 100%;
|
||||
background-color: $color-silver-light;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue