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

Function insetPath

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

Source from the content-addressed store, hash-verified

1211}
1212
1213function insetPath(value: string, position: Position): UIBezierPath {
1214 const arr = value.split(/[\s]+/);
1215
1216 let topString: string;
1217 let rightString: string;
1218 let bottomString: string;
1219 let leftString: string;
1220 if (arr.length === 1) {
1221 topString = rightString = bottomString = leftString = arr[0];
1222 } else if (arr.length === 2) {
1223 topString = bottomString = arr[0];
1224 rightString = leftString = arr[1];
1225 } else if (arr.length === 3) {
1226 topString = arr[0];
1227 rightString = leftString = arr[1];
1228 bottomString = arr[2];
1229 } else if (arr.length === 4) {
1230 topString = arr[0];
1231 rightString = arr[1];
1232 bottomString = arr[2];
1233 leftString = arr[3];
1234 }
1235
1236 const top = cssValueToDeviceIndependentPixels(topString, position.bottom);
1237 const right = cssValueToDeviceIndependentPixels('100%', position.right) - cssValueToDeviceIndependentPixels(rightString, position.right);
1238 const bottom = cssValueToDeviceIndependentPixels('100%', position.bottom) - cssValueToDeviceIndependentPixels(bottomString, position.bottom);
1239 const left = cssValueToDeviceIndependentPixels(leftString, position.right);
1240
1241 return UIBezierPath.bezierPathWithRect(CGRectMake(left, top, right - left, bottom - top)).CGPath;
1242}
1243
1244function circlePath(value: string, position: Position): UIBezierPath {
1245 const arr = value.split(/[\s]+/);

Callers 1

generateClipPathFunction · 0.85

Calls 1

Tested by

no test coverage detected