Skip to content

Commit f6ce0f6

Browse files
committed
fix: check that coordinates are actual numbers before proceeding with syncing values
1 parent 4536bd7 commit f6ce0f6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/uui-color-area/lib/uui-color-area.element.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ export class UUIColorAreaElement extends LitElement {
181181

182182
drag(grid, {
183183
onMove: (x, y) => {
184+
// check if coordinates are not NaN (can happen when dragging outside of the grid)
185+
if (isNaN(x) || isNaN(y)) return;
186+
184187
this.saturation = clamp((x / width) * 100, 0, 100);
185188
this.brightness = clamp(100 - (y / height) * 100, 0, 100);
186189
this.lightness = this.getLightness(this.brightness);

0 commit comments

Comments
 (0)