MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / polygonPath

Function polygonPath

packages/core/ui/styling/background.ios.ts:1269–1292  ·  view source on GitHub ↗
(value: string, position: Position)

Source from the content-addressed store, hash-verified

1267}
1268
1269function polygonPath(value: string, position: Position): UIBezierPath {
1270 const path = CGPathCreateMutable();
1271
1272 let firstPoint: Point;
1273 const arr = value.split(/[,]+/);
1274 for (let i = 0; i < arr.length; i++) {
1275 const xy = arr[i].trim().split(/[\s]+/);
1276 const point: Point = {
1277 x: cssValueToDeviceIndependentPixels(xy[0], position.right),
1278 y: cssValueToDeviceIndependentPixels(xy[1], position.bottom),
1279 };
1280
1281 if (!firstPoint) {
1282 firstPoint = point;
1283 CGPathMoveToPoint(path, null, point.x, point.y);
1284 }
1285
1286 CGPathAddLineToPoint(path, null, point.x, point.y);
1287 }
1288
1289 CGPathAddLineToPoint(path, null, firstPoint.x, firstPoint.y);
1290
1291 return path;
1292}

Callers 1

generateClipPathFunction · 0.85

Calls 1

Tested by

no test coverage detected