diff options
Diffstat (limited to 'macos/Sources/Helpers/Extensions/View+Extension.swift')
| -rw-r--r-- | macos/Sources/Helpers/Extensions/View+Extension.swift | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/macos/Sources/Helpers/Extensions/View+Extension.swift b/macos/Sources/Helpers/Extensions/View+Extension.swift new file mode 100644 index 000000000..fb6e0c20f --- /dev/null +++ b/macos/Sources/Helpers/Extensions/View+Extension.swift @@ -0,0 +1,31 @@ +import SwiftUI + +extension View { + func innerShadow<S: Shape, ST: ShapeStyle>( + using shape: S = Rectangle(), + stroke: ST = Color.black, + width: CGFloat = 6, + blur: CGFloat = 6 + ) -> some View { + return self + .overlay( + shape + .stroke(stroke, lineWidth: width) + .blur(radius: blur) + .mask(shape) + ) + } +} + +extension View { + func pointerStyleFromCursor(_ cursor: NSCursor) -> some View { + if #available(macOS 15.0, *) { + return self.pointerStyle(.image( + Image(nsImage: cursor.image), + hotSpot: .init(x: cursor.hotSpot.x, y: cursor.hotSpot.y) + )) + } else { + return self + } + } +} |
