mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
Design attempt
This commit is contained in:
@@ -502,7 +502,7 @@
|
||||
hideAll();
|
||||
visible = true;
|
||||
|
||||
$(doc).bind("mousedown.spectrum", hide);
|
||||
$(doc).bind("mousedown.spectrum", onMousedown);
|
||||
|
||||
// Piskel-specific : change the color as soon as the user does a mouseup
|
||||
$(doc).bind("mouseup.spectrum", updateColor);
|
||||
@@ -522,6 +522,16 @@
|
||||
boundElement.trigger('show.spectrum', [ colorOnShow ]);
|
||||
}
|
||||
|
||||
function onMousedown (e) {
|
||||
var target = $(e.target);
|
||||
var parents = target.parents();
|
||||
var isClickOutsideWidget = !parents.is(container) && !target.is(container);
|
||||
|
||||
if (isClickOutsideWidget) {
|
||||
hide(e);
|
||||
}
|
||||
}
|
||||
|
||||
// Piskel-specific (code extracted to method)
|
||||
function updateColor(e) {
|
||||
var colorHasChanged = !tinycolor.equals(get(), colorOnShow);
|
||||
@@ -545,7 +555,7 @@
|
||||
if (!visible || flat) { return; }
|
||||
visible = false;
|
||||
|
||||
$(doc).unbind("click.spectrum", hide);
|
||||
$(doc).unbind("mousedown.spectrum", onMousedown);
|
||||
|
||||
// Piskel-specific
|
||||
$(doc).unbind("mouseup.spectrum", updateColor);
|
||||
|
Reference in New Issue
Block a user