Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cbb3b7d

Browse files
committed
add repositionOnUpdate opts for Axes.drawLabels
- as x/y label text position can change on drag - test to come
1 parent 3746e03 commit cbb3b7d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/plots/cartesian/axes.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1756,6 +1756,7 @@ axes.drawOne = function(gd, ax, opts) {
17561756
vals: getSecondaryLabelVals(ax, vals),
17571757
layer: mainAxLayer,
17581758
cls: axId + 'tick2',
1759+
repositionOnUpdate: true,
17591760
transFn: transFn,
17601761
labelXFn: secondaryLabelFns.labelXFn,
17611762
labelYFn: secondaryLabelFns.labelYFn,
@@ -2283,6 +2284,7 @@ axes.drawZeroLine = function(gd, ax, opts) {
22832284
* - {array of object} vals (calcTicks output-like)
22842285
* - {d3 selection} layer
22852286
* - {string (optional)} cls (node className)
2287+
* - {boolean} repositionOnUpdate (set to true to reposition update selection)
22862288
* - {fn} transFn
22872289
* - {fn} labelXFn
22882290
* - {fn} labelYFn
@@ -2336,8 +2338,7 @@ axes.drawLabels = function(gd, ax, opts) {
23362338

23372339
tickLabels.exit().remove();
23382340

2339-
// TODO ??
2340-
if(isAngular(ax)) {
2341+
if(opts.repositionOnUpdate) {
23412342
tickLabels.each(function(d) {
23422343
d3.select(this).select('text')
23432344
.call(svgTextUtils.positionText, labelXFn(d), labelYFn(d));

src/plots/polar/polar.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,7 @@ proto.updateAngularAxis = function(fullLayout, polarLayout) {
643643
Axes.drawLabels(gd, ax, {
644644
vals: vals,
645645
layer: layers['angular-axis'],
646+
repositionOnUpdate: true,
646647
transFn: transFn,
647648
labelXFn: labelXFn,
648649
labelYFn: labelYFn,

0 commit comments

Comments
 (0)