Skip to content

Commit 1f00a40

Browse files
committed
add Lib.log when legend (x,y) are constrained into graph width/height
- N.B. need to remove legend from splom test to get Lib.log counter right.
1 parent 1e6862a commit 1f00a40

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/components/legend/draw.js

+10
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,18 @@ module.exports = function draw(gd) {
102102
var ly = gs.t + gs.h * (1 - opts.y) - FROM_TL[getYanchor(opts)] * opts._effHeight;
103103

104104
if(fullLayout.margin.autoexpand) {
105+
var lx0 = lx;
106+
var ly0 = ly;
107+
105108
lx = Lib.constrain(lx, 0, fullLayout.width - opts._width);
106109
ly = Lib.constrain(ly, 0, fullLayout.height - opts._effHeight);
110+
111+
if(lx !== lx0) {
112+
Lib.log('Constrain legend.x to make legend fit inside graph');
113+
}
114+
if(ly !== ly0) {
115+
Lib.log('Constrain legend.y to make legend fit inside graph');
116+
}
107117
}
108118

109119
// Set size and position of all the elements that make up a legend:

test/jasmine/tests/splom_test.js

+1
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,7 @@ describe('Test splom interactions:', function() {
945945

946946
it('@gl should clear graph and replot when canvas and WebGL context dimensions do not match', function(done) {
947947
var fig = Lib.extendDeep({}, require('@mocks/splom_iris.json'));
948+
fig.layout.showlegend = false;
948949

949950
function assertDims(msg, w, h) {
950951
var canvas = gd._fullLayout._glcanvas;

0 commit comments

Comments
 (0)