Skip to content

Commit 30f3c72

Browse files
authored
Merge pull request #6002 from plotly/colorbar-xanchor-center
Fix horizontal alignment of colorbar in editable mode when xanchor is set to center
2 parents ac37c68 + be01d5c commit 30f3c72

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

draftlogs/6002_fix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Fix horizontal alignment of colorbar in editable mode when `xanchor` is set to "center" [[#6002](https://github.com/plotly/plotly.js/pull/6002)]

src/components/colorbar/draw.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ function drawColorBar(g, opts, gd) {
208208
// then fix at the end (since we don't know the width yet)
209209
var xLeft = Math.round(opts.x * gs.w + opts.xpad);
210210
// for dragging... this is getting a little muddled...
211-
var xLeftFrac = opts.x - thickFrac * ({middle: 0.5, right: 1}[opts.xanchor] || 0);
211+
var xLeftFrac = opts.x - thickFrac * ({center: 0.5, right: 1}[opts.xanchor] || 0);
212212

213213
// y positioning we can do correctly from the start
214214
var yBottomFrac = opts.y + lenFrac * (({top: -0.5, bottom: 0.5}[opts.yanchor] || 0) - 0.5);

0 commit comments

Comments
 (0)