Skip to content

Commit 4c99aeb

Browse files
committed
rename xLeft to u
1 parent 5c8fcf7 commit 4c99aeb

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/components/colorbar/draw.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,9 @@ function drawColorBar(g, opts, gd) {
219219

220220
// x positioning: do it initially just for left anchor,
221221
// then fix at the end (since we don't know the width yet)
222-
var xLeft = Math.round(optsX * gs.w + xpad);
222+
var u = Math.round(optsX * gs.w + xpad);
223223
// for dragging... this is getting a little muddled...
224-
var xLeftFrac = optsX - thickFrac * ({center: 0.5, right: 1}[xanchor] || 0);
224+
var uFrac = optsX - thickFrac * ({center: 0.5, right: 1}[xanchor] || 0);
225225

226226
// y positioning we can do correctly from the start
227227
var yBottomFrac = optsY + lenFrac * (({top: -0.5, bottom: 0.5}[yanchor] || 0) - 0.5);
@@ -231,7 +231,7 @@ function drawColorBar(g, opts, gd) {
231231
// stash a few things for makeEditable
232232
opts._lenFrac = lenFrac;
233233
opts._thickFrac = thickFrac;
234-
opts._xLeftFrac = xLeftFrac;
234+
opts._uFrac = uFrac;
235235
opts._yBottomFrac = yBottomFrac;
236236

237237
// stash mocked axis for contour label formatting
@@ -431,7 +431,7 @@ function drawColorBar(g, opts, gd) {
431431
// Colorbar cannot currently support opacities so we
432432
// use an opaque fill even when alpha channels present
433433
var fillEl = d3.select(this).attr({
434-
x: xLeft,
434+
x: u,
435435
width: Math.max(thickPx, 2),
436436
y: d3.min(z),
437437
height: Math.max(d3.max(z) - d3.min(z), 2),
@@ -455,15 +455,15 @@ function drawColorBar(g, opts, gd) {
455455
lines.exit().remove();
456456
lines.each(function(d) {
457457
d3.select(this)
458-
.attr('d', 'M' + xLeft + ',' +
458+
.attr('d', 'M' + u + ',' +
459459
(Math.round(ax.c2p(d)) + (line.width / 2) % 1) + 'h' + thickPx)
460460
.call(Drawing.lineGroupStyle, line.width, lineColormap(d), line.dash);
461461
});
462462

463463
// force full redraw of labels and ticks
464464
axLayer.selectAll('g.' + ax._id + 'tick,path').remove();
465465

466-
var shift = xLeft + thickPx +
466+
var shift = u + thickPx +
467467
(outlinewidth || 0) / 2 - (opts.ticks === 'outside' ? 1 : 0);
468468

469469
var vals = Axes.calcTicks(ax);
@@ -506,7 +506,7 @@ function drawColorBar(g, opts, gd) {
506506
// (except for top/bottom mathjax, above)
507507
// but the weird gs.l is because the titleunshift
508508
// transform gets removed by Drawing.bBox
509-
titleWidth = Drawing.bBox(titleCont.node()).right - xLeft - gs.l;
509+
titleWidth = Drawing.bBox(titleCont.node()).right - u - gs.l;
510510
}
511511
innerWidth = Math.max(innerWidth, titleWidth);
512512
}
@@ -515,7 +515,7 @@ function drawColorBar(g, opts, gd) {
515515
var outerheight = yBottomPx - yTopPx;
516516

517517
g.select('.' + cn.cbbg).attr({
518-
x: xLeft - xpad - (borderwidth + outlinewidth) / 2,
518+
x: u - xpad - (borderwidth + outlinewidth) / 2,
519519
y: yTopPx - yExtraPx,
520520
width: Math.max(outerwidth, 2),
521521
height: Math.max(outerheight + 2 * yExtraPx, 2)
@@ -525,7 +525,7 @@ function drawColorBar(g, opts, gd) {
525525
.style('stroke-width', borderwidth);
526526

527527
g.selectAll('.' + cn.cboutline).attr({
528-
x: xLeft,
528+
x: u,
529529
y: yTopPx + ypad + (titleSide === 'top' ? titleHeight : 0),
530530
width: Math.max(thickPx, 2),
531531
height: Math.max(outerheight - 2 * ypad - titleHeight, 2)
@@ -596,7 +596,7 @@ function makeEditable(g, opts, gd) {
596596
moveFn: function(dx, dy) {
597597
g.attr('transform', t0 + strTranslate(dx, dy));
598598

599-
xf = dragElement.align(opts._xLeftFrac + (dx / gs.w), opts._thickFrac,
599+
xf = dragElement.align(opts._uFrac + (dx / gs.w), opts._thickFrac,
600600
0, 1, opts.xanchor);
601601
yf = dragElement.align(opts._yBottomFrac - (dy / gs.h), opts._lenFrac,
602602
0, 1, opts.yanchor);

0 commit comments

Comments
 (0)