From 4bcdbb78b131e6f7439392457fd63390d892e4ce Mon Sep 17 00:00:00 2001 From: tophf Date: Thu, 16 Aug 2018 19:58:05 +0300 Subject: [PATCH] ensure max>=min to keep colorpicker in view --- vendor-overwrites/colorpicker/colorpicker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor-overwrites/colorpicker/colorpicker.js b/vendor-overwrites/colorpicker/colorpicker.js index cc37c5e0..2617b5e9 100644 --- a/vendor-overwrites/colorpicker/colorpicker.js +++ b/vendor-overwrites/colorpicker/colorpicker.js @@ -788,8 +788,8 @@ const maxTopUnobscured = options.top <= maxTop ? maxTop : options.top - height - 20; const maxRight = window.innerWidth - width; const maxRightUnobscured = options.left <= maxRight ? maxRight : options.left - width; - const left = constrain(0, maxRightUnobscured, options.left); - const top = constrain(0, maxTopUnobscured, options.top); + const left = constrain(0, Math.max(0, maxRightUnobscured), options.left); + const top = constrain(0, Math.max(0, maxTopUnobscured), options.top); $root.style.setProperty('left', left + 'px', 'important'); $root.style.setProperty('top', top + 'px', 'important'); }