Nothing happens for onHover
. Why?
.overlay {
Rectangle()
.frame(width: 8, height: 100)
.cornerRadius(4)
.foregroundColor(isLeftBarHighlighted ? Color.gray.opacity(0.8) : Color.gray.opacity(0.5))
.offset(x: x1Movement - geometry.size.width / 2.0 + 300.0 - 8.0, y: 0)
Rectangle()
.frame(width: 16, height: geometry.size.height)
.foregroundColor(Color.gray.opacity(barTransparency))
.gesture(DragGesture()
.onChanged { value in
withAnimation(.easeInOut(duration: 0.1)) {
x1Movement = value.translation.width
}
}
)
.onHover { isHovering in
withAnimation(.easeInOut(duration: 0.1)) {
isLeftBarHighlighted = isHovering
}
}
.offset(x: x1Movement - geometry.size.width / 2.0 + 300.0 - 8.0, y: 0)
Rectangle()
.frame(width: 8, height: 100)
.cornerRadius(4)
.foregroundColor(isRightBarHighlighted ? Color.gray.opacity(0.8) : Color.gray.opacity(0.5))
.offset(x: x2Movement + geometry.size.width / 2.0 - 300.0 - 8.0, y: 0)
Rectangle()
.frame(width: 16, height: geometry.size.height)
.foregroundColor(Color.gray.opacity(barTransparency))
.gesture(DragGesture()
.onChanged { value in
withAnimation(.easeInOut(duration: 0.1)) {
x2Movement = value.translation.width
}
}
)
.onHover { isHovering in
withAnimation(.easeInOut(duration: 0.1)) {
isRightBarHighlighted = isHovering
}
}
.offset(x: x2Movement + geometry.size.width / 2.0 - 300.0 - 8.0, y: 0)
}
}
}
}