Skip to content

Commit fe3d7ed

Browse files
cleaner code for vpad assignment
1 parent 57cc05a commit fe3d7ed

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

src/traces/box/cross_trace_calc.js

+3-14
Original file line numberDiff line numberDiff line change
@@ -106,20 +106,9 @@ function setPositionOffset(traceType, gd, boxList, posAxis, pad) {
106106
// autoscale the x axis - including space for points if they're off the side
107107
// TODO: this will overdo it if the outermost boxes don't have
108108
// their points as far out as the other boxes
109-
var vpadminus = 0;
110-
var vpadplus = 0;
111-
if(calcTrace[0].trace.side === 'positive') {
112-
vpadminus = 0;
113-
vpadplus = thisDPos + pad[1] * padfactor;
114-
} else if(calcTrace[0].trace.side === 'negative') {
115-
vpadminus = thisDPos + pad[0] * padfactor;
116-
vpadplus = 0;
117-
} else {
118-
// if side === 'both'
119-
vpadminus = thisDPos + pad[0] * padfactor;
120-
vpadplus = thisDPos + pad[1] * padfactor;
121-
}
122-
109+
var side = calcTrace[0].trace.side;
110+
var vpadminus = (side === 'positive') ? 0 : (thisDPos + pad[0] * padfactor);
111+
var vpadplus = (side === 'negative') ? 0 : (thisDPos + pad[1] * padfactor);
123112
var extremes = Axes.findExtremes(posAxis, positions, {
124113
vpadminus: vpadminus,
125114
vpadplus: vpadplus

0 commit comments

Comments
 (0)