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

Visualization rendering getting cut in editor on first load #3794

Merged
merged 1 commit into from
May 13, 2019

Conversation

kravets-levko
Copy link
Collaborator

What type of PR is this? (check all applicable)

  • Bug Fix

Description

Ant Modal has open/close animation (Bootstrap modal didn't), which affects resize-event directive: it uses offsetWidth/offsetHeight properties and does not take into account any sort of CSS transformations. Solution: use getBoundingClientRect which returns real element dimensions.

Related Tickets & Documents

Fixes #3753

const bounds = node.getBoundingClientRect();
// convert to int (because these numbers needed for comparisons), but preserve 1 decimal point
const width = Math.round(bounds.width * 10);
const height = Math.round(bounds.height * 10);
Copy link
Contributor

Choose a reason for hiding this comment

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

This definitely works but kinda confusing cause it's not storing the actual dimensions.
Perhaps bounds.width.toFixed(1) can work?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Well, it's actually the same - just I store int, but this will store string. But in fact we just need some normalized values that we can compare. Since your variant will do exactly the same as mine, and we'll remove this directive after React migration - I prefer to keep this as is.

@kravets-levko kravets-levko merged commit c74d469 into master May 13, 2019
@kravets-levko kravets-levko deleted the bug/visualizations-getting-cut-in-editor branch May 13, 2019 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Visualization rendering getting cut in editor on first load
2 participants