Rectangle.render() — react Function Reference
Architecture documentation for the Rectangle.render() function in Rectangle.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD dfbfbf75_fe97_6659_07c8_00eb3770bb90["Rectangle.render()"] ea0dc1e0_cf78_f556_8a65_626310a7f23b["Rectangle.js"] dfbfbf75_fe97_6659_07c8_00eb3770bb90 -->|defined in| ea0dc1e0_cf78_f556_8a65_626310a7f23b style dfbfbf75_fe97_6659_07c8_00eb3770bb90 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-art/npm/Rectangle.js lines 43–124
render: function render() {
var width = this.props.width;
var height = this.props.height;
var radius = this.props.radius ? this.props.radius : 0;
// if unspecified, radius(Top|Bottom)(Left|Right) defaults to the radius
// property
var tl = this.props.radiusTopLeft ? this.props.radiusTopLeft : radius;
var tr = this.props.radiusTopRight ? this.props.radiusTopRight : radius;
var br = this.props.radiusBottomRight
? this.props.radiusBottomRight
: radius;
var bl = this.props.radiusBottomLeft ? this.props.radiusBottomLeft : radius;
var path = Path();
// for negative width/height, offset the rectangle in the negative x/y
// direction. for negative radius, just default to 0.
if (width < 0) {
path.move(width, 0);
width = -width;
}
if (height < 0) {
path.move(0, height);
height = -height;
}
if (tl < 0) {
tl = 0;
}
if (tr < 0) {
tr = 0;
}
if (br < 0) {
br = 0;
}
if (bl < 0) {
bl = 0;
}
// disable border radius if it doesn't fit within the specified
// width/height
if (tl + tr > width) {
tl = 0;
tr = 0;
}
if (bl + br > width) {
bl = 0;
br = 0;
}
if (tl + bl > height) {
tl = 0;
bl = 0;
}
if (tr + br > height) {
tr = 0;
br = 0;
}
path.move(0, tl);
if (tl > 0) {
path.arc(tl, -tl);
}
path.line(width - (tr + tl), 0);
if (tr > 0) {
path.arc(tr, tr);
}
path.line(0, height - (tr + br));
if (br > 0) {
path.arc(-br, br);
}
path.line(-width + (br + bl), 0);
if (bl > 0) {
path.arc(-bl, -bl);
}
path.line(0, -height + (bl + tl));
return React.createElement(Shape, assign({}, this.props, {d: path}));
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does Rectangle.render() do?
Rectangle.render() is a function in the react codebase, defined in packages/react-art/npm/Rectangle.js.
Where is Rectangle.render() defined?
Rectangle.render() is defined in packages/react-art/npm/Rectangle.js at line 43.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free