-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
improve autosize in edge cases #3090
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -488,6 +488,10 @@ function setPlotContext(gd, config) { | |
if(context.setBackground === 'transparent' || typeof context.setBackground !== 'function') { | ||
context.setBackground = setBackground; | ||
} | ||
|
||
// Check if gd has a specified widht/height to begin with | ||
context._hasZeroHeight = context._hasZeroHeight || gd.clientHeight === 0; | ||
context._hasZeroWidth = context._hasZeroWidth || gd.clientWidth === 0; | ||
} | ||
|
||
function plotPolar(gd, data, layout) { | ||
|
@@ -3248,9 +3252,6 @@ function makePlotFramework(gd) { | |
var gd3 = d3.select(gd); | ||
var fullLayout = gd._fullLayout; | ||
|
||
// Check if gd has a specified height | ||
fullLayout._hasZeroHeight = gd.clientHeight === 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reason I removed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok. That looks good to me. Stashing those things The problems brought up in #3056 (comment) seemed to now be resolved. I'll test this thing on stage after lunch. |
||
|
||
// Plot container | ||
fullLayout._container = gd3.selectAll('.plot-container').data([0]); | ||
fullLayout._container.enter().insert('div', ':first-child') | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,8 +54,8 @@ function lsInner(gd) { | |
var i, subplot, plotinfo, xa, ya; | ||
|
||
fullLayout._paperdiv.style({ | ||
width: (fullLayout.autosize) ? '100%' : fullLayout.width + 'px', | ||
height: (fullLayout.autosize && !fullLayout._hasZeroHeight) ? '100%' : fullLayout.height + 'px' | ||
width: (fullLayout.autosize && !gd._context._hasZeroWidth && !gd.layout.width) ? '100%' : fullLayout.width + 'px', | ||
height: (fullLayout.autosize && !gd._context._hasZeroHeight && !gd.layout.height) ? '100%' : fullLayout.height + 'px' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just realized that one way of making sure we're not breaking anything out there would be to add a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
👍 |
||
}) | ||
.selectAll('.main-svg') | ||
.call(Drawing.setSize, fullLayout.width, fullLayout.height); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we stashing things on
_context
now?