Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: angle-slider max value #2049

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/clever-oranges-deny.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@zag-js/angle-slider": patch
---

Fix angle slider max value
4 changes: 3 additions & 1 deletion packages/machines/angle-slider/src/angle-slider.machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { dom } from "./angle-slider.dom"
import type { MachineContext, MachineState, UserDefinedContext } from "./angle-slider.types"

const MIN_VALUE = 0
const MAX_VALUE = 360
const MAX_VALUE = 359

export function machine(userContext: UserDefinedContext) {
const ctx = compact(userContext)
Expand Down Expand Up @@ -176,6 +176,8 @@ const invoke = {
const set = {
value: (ctx: MachineContext, value: number) => {
if (ctx.value === value) return
if (value < MIN_VALUE || value > MAX_VALUE) return

ctx.value = value
invoke.valueChange(ctx)
},
Expand Down
Loading