Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f3357f5

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

File tree

Expand file treeCollapse file tree

1 file changed

+4
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-5
lines changed

‎src/components/shapes/defaults.js

Copy file name to clipboardExpand all lines: src/components/shapes/defaults.js
+4-5Lines changed: 4 additions & 5 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.