Skip to content

Commit 8d35f6e

Browse files
committed
set default angle to auto for all shapes
1 parent 40933d0 commit 8d35f6e

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

src/components/shapes/attributes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ module.exports = templatedArray('shape', {
258258
},
259259
textangle: {
260260
valType: 'angle',
261+
dflt: 'auto',
261262
editType: 'calc+arraydraw',
262263
description: [
263264
'Sets the angle at which the label text is drawn',

src/components/shapes/defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ function handleShapeDefaults(shapeIn, shapeOut, fullLayout) {
137137
var isLine = shapeType === 'line';
138138
var labelText = coerce('label.text');
139139
if(labelText) {
140-
coerce('label.textangle', isLine ? 'auto' : 0);
140+
coerce('label.textangle');
141141
var labelTextPosition = coerce('label.textposition', isLine ? 'middle' : 'middle center');
142142
coerce('label.xanchor');
143143
coerce('label.yanchor', dfltLabelYanchor(isLine, labelTextPosition));

src/components/shapes/draw.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,8 +674,6 @@ function drawLabel(gd, index, options, shapeGroup) {
674674
textangle = calcTextAngle(shapex0, shapey0, shapex1, shapey1);
675675
} else {
676676
// Auto angle for all other shapes is 0
677-
// The default angle for other shapes is 0 anyway, so there's no reason to
678-
// explicitly set the angle to `auto`, this is just covering an edge case
679677
textangle = 0;
680678
}
681679
}

src/components/shapes/draw_newshape/attributes.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,13 @@ module.exports = {
111111
},
112112
textangle: {
113113
valType: 'angle',
114+
dflt: 'auto',
114115
editType: 'none',
115116
description: [
116117
'Sets the angle at which the label text is drawn',
117-
'with respect to the horizontal. For lines, the default textangle is `auto`,',
118-
'which displays the text at the same angle as the line. For all other shapes,',
119-
'the default textangle is 0 (horizontal).'
118+
'with respect to the horizontal. For lines, angle `auto`',
119+
'is the same angle as the line. For all other shapes,',
120+
'angle `auto` is horizontal.'
120121
].join(' ')
121122
},
122123
xanchor: {

src/components/shapes/draw_newshape/defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module.exports = function supplyDrawNewShapeDefaults(layoutIn, layoutOut, coerce
3636
var isLine = layoutIn.dragmode === 'drawline';
3737
var labelText = coerce('newshape.label.text');
3838
if(labelText) {
39-
coerce('newshape.label.textangle', isLine ? 'auto' : 0);
39+
coerce('newshape.label.textangle');
4040
var labelTextPosition = coerce('newshape.label.textposition', isLine ? 'middle' : 'middle center');
4141
coerce('newshape.label.xanchor');
4242
coerce('newshape.label.yanchor', dfltLabelYanchor(isLine, labelTextPosition));

0 commit comments

Comments
 (0)