Skip to content
Merged
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
4 changes: 4 additions & 0 deletions packages/@react-spectrum/color/src/ColorThumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,15 @@ function ColorLoupe({isOpen, valueCSS, containerRef, loupeRef, style}: any) {
let thumbTop = style.top || '50%';
if (typeof thumbTop === 'string' && thumbTop.endsWith('%')) {
thumbTop = parseFloat(style.top || '50%') / 100 * containerRect.height;
} else if (typeof thumbTop === 'string' && thumbTop.endsWith('px')) {
thumbTop = parseFloat(thumbTop);
}

let thumbLeft = style.left || '50%';
if (typeof thumbLeft === 'string' && thumbLeft.endsWith('%')) {
thumbLeft = parseFloat(thumbLeft || '50%') / 100 * containerRect.width;
} else if (typeof thumbLeft === 'string' && thumbLeft.endsWith('px')) {
thumbLeft = parseFloat(thumbLeft);
}

return (
Expand Down
Loading