Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2db8707

Browse filesBrowse files
authored
Merge pull request plotly#2283 from plotly/layout-resize
Layout resize fix
2 parents 536ba6f + be05b1c commit 2db8707
Copy full SHA for 2db8707

File tree

2 files changed

+24
-1
lines changed
Filter options

2 files changed

+24
-1
lines changed

‎src/plot_api/plot_api.js

Copy file name to clipboardExpand all lines: src/plot_api/plot_api.js
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,11 @@ Plotly.plot = function(gd, data, layout, config) {
225225
'height': '100%',
226226
'overflow': 'visible',
227227
'pointer-events': 'none'
228-
})
228+
});
229+
}
230+
231+
if(fullLayout._glcanvas) {
232+
fullLayout._glcanvas
229233
.attr('width', fullLayout.width)
230234
.attr('height', fullLayout.height);
231235
}

‎test/jasmine/tests/gl2d_plot_interact_test.js

Copy file name to clipboardExpand all lines: test/jasmine/tests/gl2d_plot_interact_test.js
+19Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,25 @@ describe('Test gl plot side effects', function() {
184184
})
185185
.then(done);
186186
});
187+
188+
it('should be able to resize canvas properly', function(done) {
189+
var _mock = Lib.extendDeep({}, require('@mocks/gl2d_10.json'));
190+
_mock.data[0].line.width = 5;
191+
192+
_mock.layout.width = 600;
193+
194+
Plotly.plot(gd, _mock)
195+
.then(function() {
196+
expect(gd.querySelector('.gl-canvas-context').width).toBe(600);
197+
198+
Plotly.relayout(gd, {width: 300});
199+
})
200+
.then(function() {
201+
expect(gd.querySelector('.gl-canvas-context').width).toBe(300);
202+
})
203+
.catch(fail)
204+
.then(done);
205+
});
187206
});
188207

189208
describe('Test gl2d plots', function() {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.