MCPcopy
hub / github.com/microsoft/SandDance / rectangle1

Function rectangle1

docs/app/js/sanddance-app.js:121682–121703  ·  view source on GitHub ↗
(_, x0, y0)

Source from the content-addressed store, hash-verified

121680function vg_rect() {
121681 var x7 = rectangleX, y6 = rectangleY, width = rectangleWidth, height = rectangleHeight, crTL = number(0), crTR = crTL, crBL = crTL, crBR = crTL, context16 = null;
121682 function rectangle1(_, x0, y0) {
121683 var buffer, x1 = x0 != null ? x0 : +x7.call(this, _), y1 = y0 != null ? y0 : +y6.call(this, _), w2 = +width.call(this, _), h7 = +height.call(this, _), s = Math.min(w2, h7) / 2, tl1 = clamp(+crTL.call(this, _), 0, s), tr1 = clamp(+crTR.call(this, _), 0, s), bl1 = clamp(+crBL.call(this, _), 0, s), br1 = clamp(+crBR.call(this, _), 0, s);
121684 if (!context16) context16 = buffer = (0, _d3Path.path)();
121685 if (tl1 <= 0 && tr1 <= 0 && bl1 <= 0 && br1 <= 0) context16.rect(x1, y1, w2, h7);
121686 else {
121687 var x2 = x1 + w2, y2 = y1 + h7;
121688 context16.moveTo(x1 + tl1, y1);
121689 context16.lineTo(x2 - tr1, y1);
121690 context16.bezierCurveTo(x2 - C * tr1, y1, x2, y1 + C * tr1, x2, y1 + tr1);
121691 context16.lineTo(x2, y2 - br1);
121692 context16.bezierCurveTo(x2, y2 - C * br1, x2 - C * br1, y2, x2 - br1, y2);
121693 context16.lineTo(x1 + bl1, y2);
121694 context16.bezierCurveTo(x1 + C * bl1, y2, x1, y2 - C * bl1, x1, y2 - bl1);
121695 context16.lineTo(x1, y1 + tl1);
121696 context16.bezierCurveTo(x1, y1 + C * tl1, x1 + C * tl1, y1, x1 + tl1, y1);
121697 context16.closePath();
121698 }
121699 if (buffer) {
121700 context16 = null;
121701 return buffer + "" || null;
121702 }
121703 }
121704 rectangle1.x = function(_) {
121705 if (arguments.length) {
121706 x7 = number(_);

Callers

nothing calls this directly

Calls 6

clampFunction · 0.70
minMethod · 0.45
rectMethod · 0.45
moveToMethod · 0.45
lineToMethod · 0.45
closePathMethod · 0.45

Tested by

no test coverage detected