Change: hide colorpicker on click
This commit is contained in:
parent
da17c1ea82
commit
aef4589916
|
@ -178,6 +178,8 @@
|
|||
|
||||
HUE_COLORS.forEach(color => Object.assign(color, stringToColor(color.hex)));
|
||||
|
||||
$root.tabIndex = 0;
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
|
@ -552,7 +554,7 @@
|
|||
function onMouseUp(event) {
|
||||
if (releaseMouse(event, ['saturation', 'hue', 'opacity']) &&
|
||||
!event.target.closest('.codemirror-colorview, .colorpicker-popup, .CodeMirror')) {
|
||||
hide();
|
||||
// hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -604,6 +606,14 @@
|
|||
}
|
||||
}
|
||||
|
||||
function onClick(event) {
|
||||
setTimeout(() => {
|
||||
if (!document.activeElement.closest('.colorpicker-popup')) {
|
||||
hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//endregion
|
||||
//region Event utilities
|
||||
|
||||
|
@ -661,6 +671,7 @@
|
|||
function registerEvents() {
|
||||
window.addEventListener('keydown', onKeyDown, true);
|
||||
window.addEventListener('close-colorpicker-popup', onCloseRequest, true);
|
||||
window.addEventListener('click', onClick);
|
||||
$root.addEventListener('mouseleave', snooze);
|
||||
$root.addEventListener('mouseenter', stopSnoozing);
|
||||
$root.addEventListener('input', setFromInputs);
|
||||
|
@ -682,6 +693,7 @@
|
|||
function unregisterEvents() {
|
||||
window.removeEventListener('keydown', onKeyDown, true);
|
||||
window.removeEventListener('close-colorpicker-popup', hide, true);
|
||||
window.removeEventListener('click', onClick);
|
||||
$root.removeEventListener('mouseleave', snooze);
|
||||
$root.removeEventListener('mouseenter', stopSnoozing);
|
||||
$root.removeEventListener('input', setFromInputs);
|
||||
|
|
Loading…
Reference in New Issue
Block a user