Skip to content

Commit 0496144

Browse files
committed
stash layer clipId value (null or same as clipId)
- to DRY up Drawing.setClipUrl calls downstream, where `if(plotinfo._hasClipOnAxisFalse)` statements are removed.
1 parent 62ab845 commit 0496144

File tree

4 files changed

+9
-13
lines changed

4 files changed

+9
-13
lines changed

src/components/errorbars/plot.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,7 @@ module.exports = function plot(traces, plotinfo, transitionOpts) {
6161
.style('opacity', 1);
6262
}
6363

64-
errorbars.call(
65-
Drawing.setClipUrl,
66-
plotinfo._hasClipOnAxisFalse ? plotinfo.clipId : null
67-
);
64+
Drawing.setClipUrl(errorbars, plotinfo.layerClipId);
6865

6966
errorbars.each(function(d) {
7067
var errorbar = d3.select(this);

src/plot_api/subroutines.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ exports.lsInner = function(gd) {
178178
layerClipId = null;
179179
}
180180

181-
plotinfo.plot.call(Drawing.setClipUrl, plotClipId);
181+
Drawing.setClipUrl(plotinfo.plot, plotClipId);
182182

183183
for(i = 0; i < cartesianConstants.layers.length; i++) {
184184
var layer = cartesianConstants.layers[i];
@@ -187,6 +187,10 @@ exports.lsInner = function(gd) {
187187
}
188188
}
189189

190+
// stash layer clipId value (null or same as clipId)
191+
// to DRY up Drawing.setClipUrl calls downstream
192+
plotinfo.layerClipId = layerClipId;
193+
190194
var xlw = Drawing.crispRound(gd, xa.linewidth, 1),
191195
ylw = Drawing.crispRound(gd, ya.linewidth, 1),
192196
xp = gs.p + ylw,

src/traces/scatter/plot.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,7 @@ function createFills(gd, scatterlayer, plotinfo) {
139139
trace._ownFill = null;
140140
}
141141

142-
if(plotinfo._hasClipOnAxisFalse) {
143-
tr.selectAll('.js-fill').call(Drawing.setClipUrl, plotinfo.clipId);
144-
}
142+
tr.selectAll('.js-fill').call(Drawing.setClipUrl, plotinfo.layerClipId);
145143
});
146144
}
147145

@@ -328,9 +326,7 @@ function plotOne(gd, idx, plotinfo, cdscatter, cdscatterAll, element, transition
328326
.call(Drawing.lineGroupStyle)
329327
.each(makeUpdate(true));
330328

331-
if(plotinfo._hasClipOnAxisFalse) {
332-
Drawing.setClipUrl(lineJoin, plotinfo.clipId);
333-
}
329+
Drawing.setClipUrl(lineJoin, plotinfo.layerClipId);
334330

335331
if(segments.length) {
336332
if(ownFillEl3) {

src/traces/scatterternary/plot.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ module.exports = function plot(ternary, moduleCalcData) {
2323
xaxis: ternary.xaxis,
2424
yaxis: ternary.yaxis,
2525
plot: plotContainer,
26-
clipId: ternary.clipIdRelative,
27-
_hasClipOnAxisFalse: ternary._hasClipOnAxisFalse
26+
layerClipId: ternary._hasClipOnAxisFalse ? ternary.clipIdRelative : null
2827
};
2928

3029
// add ref to ternary subplot object in fullData traces

0 commit comments

Comments
 (0)