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

Function maskLayerIfNeeded

packages/core/ui/styling/background.ios.ts:363–382  ·  view source on GitHub ↗
(nativeView: NativeScriptUIView, background: BackgroundDefinition)

Source from the content-addressed store, hash-verified

361}
362
363function maskLayerIfNeeded(nativeView: NativeScriptUIView, background: BackgroundDefinition) {
364 const layer: CALayer = nativeView.layer;
365
366 // Check if layer should be masked
367 if (!(layer.mask instanceof CAShapeLayer)) {
368 // Since layers can only accept up to a single mask at a time, clip path is given more priority
369 if (background.clipPath) {
370 nativeView.maskType = iosViewUtils.LayerMask.CLIP_PATH;
371 } else if (!background.hasUniformBorder() && background.hasBorderRadius()) {
372 nativeView.maskType = iosViewUtils.LayerMask.BORDER;
373 } else {
374 nativeView.maskType = null;
375 }
376
377 if (nativeView.maskType != null) {
378 nativeView.originalMask = layer.mask;
379 layer.mask = CAShapeLayer.new();
380 }
381 }
382}
383
384function clearLayerMask(nativeView: NativeScriptUIView) {
385 if (nativeView.outerShadowContainerLayer) {

Callers 1

Calls 3

hasBorderRadiusMethod · 0.80
hasUniformBorderMethod · 0.45
newMethod · 0.45

Tested by

no test coverage detected