-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
Hello,
I found a couple errors in the documentation for Extending, specifically in the "Subclassing" section.
The first codeblock (reproduced below) has two errors:
- a colon that should be an equals sign in the third line
- a close parenthesis in the 11th line that should be in the final line instead
Reproduced codeblock:
SVG.Rounded = class extends SVG.Rect{
// Create method to proportionally scale the rounded corners
size: function(width, height) {
return this.attr({
width: width
, height: height
, rx: height / 5
, ry: height / 5
})
}
})
// Add a method to create a rounded rect
SVG.extend(SVG.Container, {
// Create a rounded element
rounded: function(width, height) {
return this.put(new SVG.Rounded).size(width, height)
}
}
And the edited code block with corrections:
SVG.Rounded = class extends SVG.Rect{
// Create method to proportionally scale the rounded corners
size = function(width, height) {
return this.attr({
width: width
, height: height
, rx: height / 5
, ry: height / 5
})
}
}
// Add a method to create a rounded rect
SVG.extend(SVG.Container, {
// Create a rounded element
rounded: function(width, height) {
return this.put(new SVG.Rounded).size(width, height)
}
})
The example code stumped me when it didn't work the first time I tried it, so I thought I'd flag the errors. Hope others find it helpful!
Metadata
Metadata
Assignees
Labels
No labels