ensure max>=min to keep colorpicker in view
This commit is contained in:
parent
adc165723c
commit
4bcdbb78b1
|
@ -788,8 +788,8 @@
|
||||||
const maxTopUnobscured = options.top <= maxTop ? maxTop : options.top - height - 20;
|
const maxTopUnobscured = options.top <= maxTop ? maxTop : options.top - height - 20;
|
||||||
const maxRight = window.innerWidth - width;
|
const maxRight = window.innerWidth - width;
|
||||||
const maxRightUnobscured = options.left <= maxRight ? maxRight : options.left - width;
|
const maxRightUnobscured = options.left <= maxRight ? maxRight : options.left - width;
|
||||||
const left = constrain(0, maxRightUnobscured, options.left);
|
const left = constrain(0, Math.max(0, maxRightUnobscured), options.left);
|
||||||
const top = constrain(0, maxTopUnobscured, options.top);
|
const top = constrain(0, Math.max(0, maxTopUnobscured), options.top);
|
||||||
$root.style.setProperty('left', left + 'px', 'important');
|
$root.style.setProperty('left', left + 'px', 'important');
|
||||||
$root.style.setProperty('top', top + 'px', 'important');
|
$root.style.setProperty('top', top + 'px', 'important');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user