mirror of
https://github.com/viliusle/miniPaint.git
synced 2026-02-06 11:21:47 +00:00
#139 - fixed colorpicker
This commit is contained in:
parent
b23601527d
commit
d86f2a5502
6
dist/bundle.js
vendored
6
dist/bundle.js
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "miniPaint",
|
||||
"version": "4.2.0",
|
||||
"version": "4.2.1",
|
||||
"author": "Vilius L.",
|
||||
"description": "Online graphics editing tool lets create, edit images using HTML5 technologies.",
|
||||
"keywords": [
|
||||
|
||||
@ -72,15 +72,30 @@ class GUI_colors_class {
|
||||
}, false);
|
||||
}
|
||||
|
||||
var changed = false;
|
||||
var last_color = config.COLOR;
|
||||
$("#main_color").spectrum({
|
||||
showAlpha: true,
|
||||
move: function(color) {
|
||||
var rgba = color.toRgb();
|
||||
|
||||
move: function(color) {
|
||||
_this.change_color(color.toHexString());
|
||||
_this.change_alpha(rgba.a * 255);
|
||||
_this.render_colors();
|
||||
},
|
||||
show: function() {
|
||||
changed = false;
|
||||
},
|
||||
change: function(color) {
|
||||
changed = true;
|
||||
},
|
||||
hide: function(color) {
|
||||
if(changed == false) {
|
||||
// revert
|
||||
_this.change_color(last_color);
|
||||
_this.render_colors();
|
||||
}
|
||||
else{
|
||||
//changed
|
||||
last_color = config.COLOR;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//colors
|
||||
|
||||
@ -86,7 +86,8 @@ class Pick_color_class extends Base_tools_class {
|
||||
}
|
||||
//find color
|
||||
var c = ctx.getImageData(mouse.x, mouse.y, 1, 1).data;
|
||||
config.COLOR = this.Helper.rgbToHex(c[0], c[1], c[2]);
|
||||
var hex = this.Helper.rgbToHex(c[0], c[1], c[2]);
|
||||
this.Base_gui.GUI_colors.change_color(hex);
|
||||
|
||||
if (c[3] > 0) {
|
||||
//set alpha
|
||||
|
||||
Loading…
Reference in New Issue
Block a user