Skip to content
Browse files

fix colorpicker autohide bug

  • Loading branch information...
1 parent f35d8da commit 0a00f03ce9b2ba207d9b0e46d30b01f879106ab1 @nightwing nightwing committed Nov 3, 2012
Showing with 7 additions and 7 deletions.
  1. +7 −7 plugins-client/ext.colorpicker/colorpicker.js
View
14 plugins-client/ext.colorpicker/colorpicker.js
@@ -166,8 +166,8 @@ module.exports = ext.register("ext/colorpicker/colorpicker", {
if (a) {
apf.removeEventListener("keydown", a.listeners.onKeyDown);
a.editor.removeEventListener("mousewheel", a.listeners.onScroll);
+ a.editor.removeEventListener("mousedown", a.listeners.onScroll);
ide.removeEventListener("codetools.cursorchange", a.listeners.onCursorChange);
- ide.removeEventListener("codetools.selectionchange", a.listeners.onSelectionChange);
delete _self.$activeColor;
_self.hideColorTooltips(a.editor);
_self.colorpicker.$input.blur();
@@ -432,7 +432,7 @@ module.exports = ext.register("ext/colorpicker/colorpicker", {
// set appropriate event listeners, that will be removed when the colorpicker
// hides.
- var onKeyDown, onScroll, onCursorChange, onSelectionChange;
+ var onKeyDown, onScroll, onCursorChange;
var _self = this;
apf.addEventListener("keydown", onKeyDown = function(e) {
var a = _self.$activeColor;
@@ -458,8 +458,7 @@ module.exports = ext.register("ext/colorpicker/colorpicker", {
var pos = e.pos.start;
var range = a.marker[0];
- if (pos.row < range.start.row || pos.row > range.end.row
- || pos.column < range.start.column || pos.column > range.end.column)
+ if (!range.contains(pos))
menu.hide();
});
@@ -471,6 +470,8 @@ module.exports = ext.register("ext/colorpicker/colorpicker", {
menu.hide();
});
+
+ editor.addEventListener("mousedown", onScroll);
var id = "colorpicker" + parsed.hex + pos.row;
delete this.$activeColor;
@@ -492,8 +493,7 @@ module.exports = ext.register("ext/colorpicker/colorpicker", {
listeners: {
onKeyDown: onKeyDown,
onScroll: onScroll,
- onCursorChange: onCursorChange,
- onSelectionChange: onSelectionChange
+ onCursorChange: onCursorChange
}
};
if (parsed.type == "rgb") {
@@ -610,7 +610,7 @@ module.exports = ext.register("ext/colorpicker/colorpicker", {
if (!range)
return;
a.marker[0] = range;
- doc.replace(range, newColor);
+ range.end = doc.replace(range, newColor);
a.current = newColor;
}, 200);
},

0 comments on commit 0a00f03

Please sign in to comment.
Something went wrong with that request. Please try again.