mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-28 07:34:32 +00:00
Fixed 1 color picker bug made home UI padding
This commit is contained in:
parent
aecbe2ac35
commit
90b5dae3ba
12 changed files with 58 additions and 122 deletions
|
|
@ -22,17 +22,16 @@ import AppKit
|
|||
import Defaults
|
||||
|
||||
struct ParallaxMotionModifier: ViewModifier {
|
||||
var magnitude: Double
|
||||
var enableOverride: Bool?
|
||||
var isSuspended: Bool
|
||||
|
||||
@Default(.enableParallaxEffect) var enableParallaxEffect
|
||||
@Default(.parallaxEffectIntensity) var parallaxEffectIntensity
|
||||
@State private var offset: CGSize = .zero
|
||||
@State private var isHovering = false
|
||||
@State private var viewSize: CGSize = .zero
|
||||
|
||||
func body(content: Content) -> some View {
|
||||
if isSuspended || !(enableOverride ?? enableParallaxEffect) {
|
||||
if isSuspended || !(enableOverride ?? (parallaxEffectIntensity > 0.0)) {
|
||||
content
|
||||
} else {
|
||||
content
|
||||
|
|
@ -69,11 +68,11 @@ struct ParallaxMotionModifier: ViewModifier {
|
|||
}
|
||||
}
|
||||
.rotation3DEffect(
|
||||
.degrees(offset.height * magnitude), // Y movement rotates around X axis
|
||||
.degrees(offset.height * parallaxEffectIntensity), // Y movement rotates around X axis
|
||||
axis: (x: 1, y: 0, z: 0)
|
||||
)
|
||||
.rotation3DEffect(
|
||||
.degrees(offset.width * -magnitude), // X movement rotates around Y axis (inverted to look naturally)
|
||||
.degrees(offset.width * -parallaxEffectIntensity), // X movement rotates around Y axis (inverted to look naturally)
|
||||
axis: (x: 0, y: 1, z: 0)
|
||||
)
|
||||
.scaleEffect(isHovering ? 1.02 : 1.0) // Subtle scale up on hover
|
||||
|
|
@ -83,10 +82,9 @@ struct ParallaxMotionModifier: ViewModifier {
|
|||
|
||||
extension View {
|
||||
func parallax3D(
|
||||
magnitude: Double = 10,
|
||||
enableOverride: Bool? = nil,
|
||||
suspended: Bool = false
|
||||
) -> some View {
|
||||
modifier(ParallaxMotionModifier(magnitude: magnitude, enableOverride: enableOverride, isSuspended: suspended))
|
||||
modifier(ParallaxMotionModifier(enableOverride: enableOverride, isSuspended: suspended))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue