Skip to content

Commit fdcaa0c

Browse files
committed
Rename x_shift/y_shift → xshift/yshift
1 parent c2f7f27 commit fdcaa0c

File tree

12 files changed

+73
-72
lines changed

12 files changed

+73
-72
lines changed

src/components/selections/attributes.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ module.exports = overrideAll(templatedArray('selection', {
5353
valType: 'any',
5454
description: 'Sets the selection\'s end y position.'
5555
},
56-
x_shift: {
56+
57+
xshift: {
5758
valType: 'number',
5859
dflt: 0,
5960
min: -0.5,
@@ -64,7 +65,7 @@ module.exports = overrideAll(templatedArray('selection', {
6465
'the reference unit.'
6566
].join(' ')
6667
},
67-
y_shift: {
68+
yshift: {
6869
valType: 'number',
6970
dflt: 0,
7071
min: -0.5,
@@ -75,6 +76,7 @@ module.exports = overrideAll(templatedArray('selection', {
7576
'the reference unit.'
7677
].join(' ')
7778
},
79+
7880
path: {
7981
valType: 'string',
8082
editType: 'arraydraw',

src/components/selections/defaults.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ function handleSelectionDefaults(selectionIn, selectionOut, fullLayout) {
4949
coerce('line.color');
5050
coerce('line.width');
5151
coerce('line.dash');
52-
coerce('x_shift');
53-
coerce('y_shift');
52+
coerce('xshift');
53+
coerce('yshift');
5454

5555
// positioning
5656
var axLetters = ['x', 'y'];

src/components/shapes/attributes.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,17 @@ module.exports = templatedArray('shape', {
169169
'See `type` and `xsizemode` for more info.'
170170
].join(' ')
171171
},
172-
172+
xshift: {
173+
valType: 'number',
174+
dflt: 0,
175+
min: -0.5,
176+
max: 0.5,
177+
editType: 'calc',
178+
description: [
179+
'Only relevant if xref is a (multi-)category axes. Shifts x0 and x1 by a fraction of',
180+
'the reference unit.'
181+
].join(' ')
182+
},
173183
yref: extendFlat({}, annAttrs.yref, {
174184
description: [
175185
'Sets the shape\'s y coordinate axis.',
@@ -220,18 +230,7 @@ module.exports = templatedArray('shape', {
220230
'See `type` and `ysizemode` for more info.'
221231
].join(' ')
222232
},
223-
x_shift: {
224-
valType: 'number',
225-
dflt: 0,
226-
min: -0.5,
227-
max: 0.5,
228-
editType: 'calc',
229-
description: [
230-
'Only relevant if xref is a (multi-)category axes. Shifts x0 and x1 by a fraction of',
231-
'the reference unit.'
232-
].join(' ')
233-
},
234-
y_shift: {
233+
yshift: {
235234
valType: 'number',
236235
dflt: 0,
237236
min: -0.5,

src/components/shapes/calc_autorange.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module.exports = function calcAutorange(gd) {
2727
var vx1 = shape.xsizemode === 'pixel' ? shape.xanchor : shape.x1;
2828
ax = Axes.getFromId(gd, shape.xref);
2929

30-
bounds = shapeBounds(ax, vx0, vx1, shape.path, shape.x_shift, constants.paramIsX);
30+
bounds = shapeBounds(ax, vx0, vx1, shape.path, shape.xshift, constants.paramIsX);
3131
if(bounds) {
3232
shape._extremes[ax._id] = Axes.findExtremes(ax, bounds, calcXPaddingOptions(shape));
3333
}
@@ -38,7 +38,7 @@ module.exports = function calcAutorange(gd) {
3838
var vy1 = shape.ysizemode === 'pixel' ? shape.yanchor : shape.y1;
3939
ax = Axes.getFromId(gd, shape.yref);
4040

41-
bounds = shapeBounds(ax, vy0, vy1, shape.path, shape.y_shift, constants.paramIsY);
41+
bounds = shapeBounds(ax, vy0, vy1, shape.path, shape.yshift, constants.paramIsY);
4242
if(bounds) {
4343
shape._extremes[ax._id] = Axes.findExtremes(ax, bounds, calcYPaddingOptions(shape));
4444
}

src/components/shapes/defaults.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ function handleShapeDefaults(shapeIn, shapeOut, fullLayout) {
7575
var pos2r;
7676
var r2pos;
7777

78-
coerce('x_shift');
79-
coerce('y_shift');
78+
coerce('xshift');
79+
coerce('yshift');
8080

8181
// xref, yref
8282
var axRef = Axes.coerceRef(shapeIn, shapeOut, gdMock, axLetter, undefined,

src/components/shapes/display_labels.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ module.exports = function drawLabel(gd, index, options, shapeGroup) {
8989
// Setup conversion functions
9090
var xa = Axes.getFromId(gd, options.xref);
9191
var xRefType = Axes.getRefType(options.xref);
92-
var xShift = options.x_shift;
92+
var xShift = options.xshift;
9393
var ya = Axes.getFromId(gd, options.yref);
9494
var yRefType = Axes.getRefType(options.yref);
95-
var yShift = options.y_shift;
95+
var yShift = options.yshift;
9696
var x2p = helpers.getDataToPixel(gd, xa, xShift, false, xRefType);
9797
var y2p = helpers.getDataToPixel(gd, ya, yShift, true, yRefType);
9898
shapex0 = x2p(options.x0);

src/components/shapes/draw.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,10 @@ function setupDragElement(gd, shapePath, shapeOptions, index, shapeLayer, editHe
225225
// setup conversion functions
226226
var xa = Axes.getFromId(gd, shapeOptions.xref);
227227
var xRefType = Axes.getRefType(shapeOptions.xref);
228-
var xShift = shapeOptions.x_shift;
228+
var xShift = shapeOptions.xshift;
229229
var ya = Axes.getFromId(gd, shapeOptions.yref);
230230
var yRefType = Axes.getRefType(shapeOptions.yref);
231-
var yShift = shapeOptions.y_shift;
231+
var yShift = shapeOptions.yshift;
232232
var x2p = helpers.getDataToPixel(gd, xa, xShift, false, xRefType);
233233
var y2p = helpers.getDataToPixel(gd, ya, yShift, true, yRefType);
234234
var p2x = helpers.getPixelToData(gd, xa, false, xRefType);

src/components/shapes/helpers.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -226,20 +226,20 @@ exports.getPathString = function(gd, options) {
226226
}
227227
if(options.xsizemode === 'pixel') {
228228
var xAnchorPos = x2p(options.xanchor);
229-
x0 = xAnchorPos + options.x0 + shiftUnitX * options.x_shift;
230-
x1 = xAnchorPos + options.x1 + shiftUnitX * options.x_shift;
229+
x0 = xAnchorPos + options.x0 + shiftUnitX * options.xshift;
230+
x1 = xAnchorPos + options.x1 + shiftUnitX * options.xshift;
231231
} else {
232-
x0 = x2p(options.x0) + shiftUnitX * options.x_shift;
233-
x1 = x2p(options.x1) + shiftUnitX * options.x_shift;
232+
x0 = x2p(options.x0) + shiftUnitX * options.xshift;
233+
x1 = x2p(options.x1) + shiftUnitX * options.xshift;
234234
}
235235

236236
if(options.ysizemode === 'pixel') {
237237
var yAnchorPos = y2p(options.yanchor);
238-
y0 = yAnchorPos - options.y0 - shiftUnitY * options.y_shift;
239-
y1 = yAnchorPos - options.y1 - shiftUnitY * options.y_shift;
238+
y0 = yAnchorPos - options.y0 - shiftUnitY * options.yshift;
239+
y1 = yAnchorPos - options.y1 - shiftUnitY * options.yshift;
240240
} else {
241-
y0 = y2p(options.y0) - shiftUnitY * options.y_shift;
242-
y1 = y2p(options.y1) - shiftUnitY * options.y_shift;
241+
y0 = y2p(options.y0) - shiftUnitY * options.yshift;
242+
y1 = y2p(options.y1) - shiftUnitY * options.yshift;
243243
}
244244

245245
if(type === 'line') return 'M' + x0 + ',' + y0 + 'L' + x1 + ',' + y1;

test/image/mocks/zzz_shape_shift_horizontal.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"y1": ["A", "D"],
4343
"x0": 0,
4444
"x1": 0.25,
45-
"y_shift": 0.5,
45+
"yshift": 0.5,
4646
"xref": "paper"
4747
},
4848
{
@@ -79,7 +79,7 @@
7979
"y1": ["B", "D"],
8080
"x0": 0,
8181
"x1": 0.25,
82-
"y_shift": -0.5,
82+
"yshift": -0.5,
8383
"xref": "paper"
8484
}
8585
]

test/image/mocks/zzz_shape_shift_vertical.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"x1": "A",
3030
"y0": 0,
3131
"y1": 0.5,
32-
"x_shift": 0.5,
32+
"xshift": 0.5,
3333
"yref": "paper"
3434
},
3535
{
@@ -48,7 +48,7 @@
4848
"x1": 3,
4949
"y0": 0,
5050
"y1": 0.5,
51-
"x_shift": -0.25,
51+
"xshift": -0.25,
5252
"yref": "paper"
5353
}
5454
],
@@ -58,7 +58,7 @@
5858
"x1": 4,
5959
"y0": 1,
6060
"y1": 3,
61-
"x_shift": -0.5
61+
"xshift": -0.5
6262
}
6363
]
6464
}

0 commit comments

Comments
 (0)