-
Notifications
You must be signed in to change notification settings - Fork 712
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
Calculate viewport dimensions from the scope-app div #2473
Conversation
// Use the `scope-app` div to determine the viewport rectangle, because `window` gives | ||
// wrong values for scope container inside Weave Cloud (on dev & prod), because of the | ||
// top navigation toolbar that is counted in, even though it's not part of Scope. | ||
const viewport = document.getElementsByClassName('scope-app')[0].getBoundingClientRect(); |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
// wrong values for scope container inside Weave Cloud (on dev & prod), because of the | ||
// top navigation toolbar that is counted in, even though it's not part of Scope. | ||
const viewport = document.getElementsByClassName('scope-app')[0].getBoundingClientRect(); | ||
// Not sure why we need to subtract `left` and `top`, but that gives us correct values. |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
b97269d
to
763b924
Compare
@foot PTAL |
I don't think this fixes #2472 anymore. Tested with service-ui@master:
I (think) I can still fix this by fiddling w/ the height though, what problems did you have with it? diff --git a/client/app/scripts/components/app.js b/client/app/scripts/components/app.js
index 6977c0f1..19eddfdc 100644
--- a/client/app/scripts/components/app.js
+++ b/client/app/scripts/components/app.js
@@ -151,7 +151,7 @@ class App extends React.Component {
const isIframe = window !== window.top;
return (
- <div className="scope-app" ref={this.saveAppRef}>
+ <div className="scope-app" style={{height: 'auto'}} ref={this.saveAppRef}>
{showingDebugToolbar() && <DebugToolbar />}
{showingHelp && <HelpPanel />} |
Ups, I forgot to update the description, sorry for that. Basically this PR is only the first step towards fixing it, the second being adding a line or two to What I suggested in #2473 (comment) was to add
|
763b924
to
d68af37
Compare
d68af37
to
e77f396
Compare
lgtm! |
Fixes #2472 by calculating the viewport dimensions from the
scope-app
div bounding rectangle instead ofwindow.width
&window.height
(the changes were pulled out from PR #2420).