Skip to content

Commit f3357f5

Browse files
authored
Merge pull request plotly#6237 from plotly/shape-path-coerce
Revisit `shape` defaults
2 parents b2df371 + 2c711a6 commit f3357f5

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/components/shapes/defaults.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ function handleShapeDefaults(shapeIn, shapeOut, fullLayout) {
2626
var path = coerce('path');
2727
var dfltType = path ? 'path' : 'rect';
2828
var shapeType = coerce('type', dfltType);
29-
if(shapeOut.type !== 'path') delete shapeOut.path;
29+
var noPath = shapeType !== 'path';
30+
if(noPath) delete shapeOut.path;
3031

3132
coerce('editable');
3233
coerce('layer');
@@ -68,7 +69,7 @@ function handleShapeDefaults(shapeIn, shapeOut, fullLayout) {
6869
}
6970

7071
// Coerce x0, x1, y0, y1
71-
if(shapeType !== 'path') {
72+
if(noPath) {
7273
var dflt0 = 0.25;
7374
var dflt1 = 0.75;
7475

@@ -112,9 +113,7 @@ function handleShapeDefaults(shapeIn, shapeOut, fullLayout) {
112113
}
113114
}
114115

115-
if(shapeType === 'path') {
116-
coerce('path');
117-
} else {
116+
if(noPath) {
118117
Lib.noneOrAll(shapeIn, shapeOut, ['x0', 'x1', 'y0', 'y1']);
119118
}
120119
}

0 commit comments

Comments
 (0)