(value: string, position: Position)
| 1267 | } |
| 1268 | |
| 1269 | function 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 | } |
no test coverage detected