Skip to content

Commit bb3f31d

Browse files
committed
Add comments
1 parent 5616f24 commit bb3f31d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/components/shapes/display_labels.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ module.exports = function drawLabel(gd, index, options, shapeGroup) {
110110
// correct final value
111111
if (options.xsizemode === 'pixel') {
112112
const xAnchorPos = x2p(options.xanchor, undefined, xa0, xRefType0);
113+
// Use xa0 for both shifts because in pixel mode x0/x1 are offsets from the
114+
// anchor, which is always on xa0 (pixel mode with array xref is unsupported)
113115
const xShift0 = helpers.getPixelShift(xa0, options.x0shift);
114116
const xShift1 = helpers.getPixelShift(xa0, options.x1shift);
115117
shapex0 = xAnchorPos + options.x0 + xShift0;
@@ -120,6 +122,7 @@ module.exports = function drawLabel(gd, index, options, shapeGroup) {
120122
}
121123
if (options.ysizemode === 'pixel') {
122124
const yAnchorPos = y2p(options.yanchor, undefined, ya0, yRefType0);
125+
// Both shifts use ya0 for the same reason as above
123126
const yShift0 = helpers.getPixelShift(ya0, options.y0shift);
124127
const yShift1 = helpers.getPixelShift(ya0, options.y1shift);
125128
shapey0 = yAnchorPos - options.y0 + yShift0;

0 commit comments

Comments
 (0)