Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PowerBI report size fix #258

Merged
merged 2 commits into from
Feb 19, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions modules/quanthub_core/js/qh_core-power-bi-customizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,18 @@ function powerbi_embed_customizeReport($, context, width = 0, height = 0, title
}
iframes[i].title = title.length > 0 ? title : 'PowerBI Embed';
iframes[i].name = name.length > 0 ? name : title.length > 0 ? title : 'PowerBI Embed';
const containerWidth = iframes[i].parentNode.offsetWidth;
const iw = width <= 0 ? '100%' : width + 'px';
const ih = height <= 0 ? iw * (19 / 32) : height;
const ih = (height <= 0 || width <= 0? containerWidth * (19 / 32) : height) + 'px';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move 19/32 to variable defaultAspectRatio


iframes[i].width = iw;
iframes[i].height = ih + 'px';
iframes[i].height = ih ;

new ResizeObserver((function() {
setTimeout(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in such case it's better to use some simply debounce here

iframes[i].height = iframes[i].parentNode.offsetWidth * (19 / 32) + 'px';
}, 500)
})).observe(iframes[i].parentNode);
}

checkTokenAndUpdate($, context);
Expand Down