[79a0317] | 1 | "use strict";
|
---|
| 2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
| 3 | exports.parsePathForBorderStroke = exports.parsePathForBorderDoubleInner = exports.parsePathForBorderDoubleOuter = exports.parsePathForBorder = void 0;
|
---|
| 4 | var bezier_curve_1 = require("./bezier-curve");
|
---|
| 5 | var parsePathForBorder = function (curves, borderSide) {
|
---|
| 6 | switch (borderSide) {
|
---|
| 7 | case 0:
|
---|
| 8 | return createPathFromCurves(curves.topLeftBorderBox, curves.topLeftPaddingBox, curves.topRightBorderBox, curves.topRightPaddingBox);
|
---|
| 9 | case 1:
|
---|
| 10 | return createPathFromCurves(curves.topRightBorderBox, curves.topRightPaddingBox, curves.bottomRightBorderBox, curves.bottomRightPaddingBox);
|
---|
| 11 | case 2:
|
---|
| 12 | return createPathFromCurves(curves.bottomRightBorderBox, curves.bottomRightPaddingBox, curves.bottomLeftBorderBox, curves.bottomLeftPaddingBox);
|
---|
| 13 | case 3:
|
---|
| 14 | default:
|
---|
| 15 | return createPathFromCurves(curves.bottomLeftBorderBox, curves.bottomLeftPaddingBox, curves.topLeftBorderBox, curves.topLeftPaddingBox);
|
---|
| 16 | }
|
---|
| 17 | };
|
---|
| 18 | exports.parsePathForBorder = parsePathForBorder;
|
---|
| 19 | var parsePathForBorderDoubleOuter = function (curves, borderSide) {
|
---|
| 20 | switch (borderSide) {
|
---|
| 21 | case 0:
|
---|
| 22 | return createPathFromCurves(curves.topLeftBorderBox, curves.topLeftBorderDoubleOuterBox, curves.topRightBorderBox, curves.topRightBorderDoubleOuterBox);
|
---|
| 23 | case 1:
|
---|
| 24 | return createPathFromCurves(curves.topRightBorderBox, curves.topRightBorderDoubleOuterBox, curves.bottomRightBorderBox, curves.bottomRightBorderDoubleOuterBox);
|
---|
| 25 | case 2:
|
---|
| 26 | return createPathFromCurves(curves.bottomRightBorderBox, curves.bottomRightBorderDoubleOuterBox, curves.bottomLeftBorderBox, curves.bottomLeftBorderDoubleOuterBox);
|
---|
| 27 | case 3:
|
---|
| 28 | default:
|
---|
| 29 | return createPathFromCurves(curves.bottomLeftBorderBox, curves.bottomLeftBorderDoubleOuterBox, curves.topLeftBorderBox, curves.topLeftBorderDoubleOuterBox);
|
---|
| 30 | }
|
---|
| 31 | };
|
---|
| 32 | exports.parsePathForBorderDoubleOuter = parsePathForBorderDoubleOuter;
|
---|
| 33 | var parsePathForBorderDoubleInner = function (curves, borderSide) {
|
---|
| 34 | switch (borderSide) {
|
---|
| 35 | case 0:
|
---|
| 36 | return createPathFromCurves(curves.topLeftBorderDoubleInnerBox, curves.topLeftPaddingBox, curves.topRightBorderDoubleInnerBox, curves.topRightPaddingBox);
|
---|
| 37 | case 1:
|
---|
| 38 | return createPathFromCurves(curves.topRightBorderDoubleInnerBox, curves.topRightPaddingBox, curves.bottomRightBorderDoubleInnerBox, curves.bottomRightPaddingBox);
|
---|
| 39 | case 2:
|
---|
| 40 | return createPathFromCurves(curves.bottomRightBorderDoubleInnerBox, curves.bottomRightPaddingBox, curves.bottomLeftBorderDoubleInnerBox, curves.bottomLeftPaddingBox);
|
---|
| 41 | case 3:
|
---|
| 42 | default:
|
---|
| 43 | return createPathFromCurves(curves.bottomLeftBorderDoubleInnerBox, curves.bottomLeftPaddingBox, curves.topLeftBorderDoubleInnerBox, curves.topLeftPaddingBox);
|
---|
| 44 | }
|
---|
| 45 | };
|
---|
| 46 | exports.parsePathForBorderDoubleInner = parsePathForBorderDoubleInner;
|
---|
| 47 | var parsePathForBorderStroke = function (curves, borderSide) {
|
---|
| 48 | switch (borderSide) {
|
---|
| 49 | case 0:
|
---|
| 50 | return createStrokePathFromCurves(curves.topLeftBorderStroke, curves.topRightBorderStroke);
|
---|
| 51 | case 1:
|
---|
| 52 | return createStrokePathFromCurves(curves.topRightBorderStroke, curves.bottomRightBorderStroke);
|
---|
| 53 | case 2:
|
---|
| 54 | return createStrokePathFromCurves(curves.bottomRightBorderStroke, curves.bottomLeftBorderStroke);
|
---|
| 55 | case 3:
|
---|
| 56 | default:
|
---|
| 57 | return createStrokePathFromCurves(curves.bottomLeftBorderStroke, curves.topLeftBorderStroke);
|
---|
| 58 | }
|
---|
| 59 | };
|
---|
| 60 | exports.parsePathForBorderStroke = parsePathForBorderStroke;
|
---|
| 61 | var createStrokePathFromCurves = function (outer1, outer2) {
|
---|
| 62 | var path = [];
|
---|
| 63 | if (bezier_curve_1.isBezierCurve(outer1)) {
|
---|
| 64 | path.push(outer1.subdivide(0.5, false));
|
---|
| 65 | }
|
---|
| 66 | else {
|
---|
| 67 | path.push(outer1);
|
---|
| 68 | }
|
---|
| 69 | if (bezier_curve_1.isBezierCurve(outer2)) {
|
---|
| 70 | path.push(outer2.subdivide(0.5, true));
|
---|
| 71 | }
|
---|
| 72 | else {
|
---|
| 73 | path.push(outer2);
|
---|
| 74 | }
|
---|
| 75 | return path;
|
---|
| 76 | };
|
---|
| 77 | var createPathFromCurves = function (outer1, inner1, outer2, inner2) {
|
---|
| 78 | var path = [];
|
---|
| 79 | if (bezier_curve_1.isBezierCurve(outer1)) {
|
---|
| 80 | path.push(outer1.subdivide(0.5, false));
|
---|
| 81 | }
|
---|
| 82 | else {
|
---|
| 83 | path.push(outer1);
|
---|
| 84 | }
|
---|
| 85 | if (bezier_curve_1.isBezierCurve(outer2)) {
|
---|
| 86 | path.push(outer2.subdivide(0.5, true));
|
---|
| 87 | }
|
---|
| 88 | else {
|
---|
| 89 | path.push(outer2);
|
---|
| 90 | }
|
---|
| 91 | if (bezier_curve_1.isBezierCurve(inner2)) {
|
---|
| 92 | path.push(inner2.subdivide(0.5, true).reverse());
|
---|
| 93 | }
|
---|
| 94 | else {
|
---|
| 95 | path.push(inner2);
|
---|
| 96 | }
|
---|
| 97 | if (bezier_curve_1.isBezierCurve(inner1)) {
|
---|
| 98 | path.push(inner1.subdivide(0.5, false).reverse());
|
---|
| 99 | }
|
---|
| 100 | else {
|
---|
| 101 | path.push(inner1);
|
---|
| 102 | }
|
---|
| 103 | return path;
|
---|
| 104 | };
|
---|
| 105 | //# sourceMappingURL=border.js.map |
---|