Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

version 3.3.0.1 #54

Merged
merged 4 commits into from
Jun 12, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
#52 - fixed issues with some tools not working with alpha set to 0
  • Loading branch information
viliusle committed Jun 12, 2017
commit ec53cb8057ec3a92c782556b6f23bd1303bb2a45
17 changes: 13 additions & 4 deletions js/draw_tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,16 @@ function DRAW_TOOLS_CLASS() {
}
};
this.fill = function (type, mouse, event) {
if (mouse.valid == false)
if (mouse.valid == false){
return true;
}
if (type == 'click') {
if(ALPHA == 0){
POP.add({html: 'Alpha color can not be zero.'});
POP.show('Error', '.');
return;
}

EDIT.save_state();
var color_to = HELPER.hex2rgb(COLOR);
color_to.a = ALPHA;
Expand All @@ -379,9 +386,11 @@ function DRAW_TOOLS_CLASS() {
var c = canvas_active().getImageData(mouse.x, mouse.y, 1, 1).data;
COLOR = "#" + ("000000" + HELPER.rgbToHex(c[0], c[1], c[2])).slice(-6);

//set alpha
ALPHA = c[3];
document.getElementById("rgb_a").value = ALPHA;
if(c[3] > 0) {
//set alpha
ALPHA = c[3];
document.getElementById("rgb_a").value = ALPHA;
}

GUI.sync_colors();
}
Expand Down
6 changes: 6 additions & 0 deletions js/gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,12 @@ function GUI_CLASS() {
document.getElementById("rgb_r").value = colors.r;
document.getElementById("rgb_g").value = colors.g;
document.getElementById("rgb_b").value = colors.b;

//also set alpha to max
if(ALPHA == 0) {
ALPHA = 255;
document.getElementById("rgb_a").value = ALPHA;
}
};

this.set_color_manual = function (event) {
Expand Down