diff --git a/src/tool-options.js b/src/tool-options.js index fd8bde8..988630e 100644 --- a/src/tool-options.js +++ b/src/tool-options.js @@ -288,3 +288,39 @@ var $choose_transparency = $Choose( return t_o === transparent_opaque; } ).addClass("choose-transparency"); + +// var $choose_transparency_unsupported = +// $choose_transparency +// .trigger("update") +// .clone() +// .attr("title", "This transparency option is not supported yet for selections.") +// .css({filter: "saturation(0)"}); +// $choose_transparency_unsupported.find("canvas").each(function(index, canvas){ +// var image = $choose_transparency.find("canvas")[index]; +// canvas.getContext("2d").drawImage(image, 0, 0); +// }); +// ^ doesn't work because ChooserCanvas has to load an image asynchronously + +var $choose_transparency_unsupported = $Choose( + ["opaque", "transparent"], + function(t_o, is_chosen){ + var sw = 35, sh = 23; // width, height from source image + var b = 2; // margin by which the source image is inset on the destination + return ChooserCanvas( + "images/options-transparency.png", + false, // never invert it + b+sw+b, b+sh+b, // width, height of created destination canvas + 0, (t_o === "opaque" ? 0 : 22), sw, sh, // x, y, width, height from source image + b, b, sw, sh // x, y, width, height on created destination canvas + ); + }, + function(t_o){ + // transparent_opaque = t_o; + }, + function(t_o){ + return t_o === "opaque";//transparent_opaque; + } +).addClass("choose-transparency") +.attr("title", "This option for transparency is not supported yet.") +.css({filter: "grayscale() opacity(0.5)"}); + diff --git a/src/tools.js b/src/tools.js index 892e4ee..36acf32 100644 --- a/src/tools.js +++ b/src/tools.js @@ -107,7 +107,7 @@ tools = [{ selection.instantiate(cutout); selection.cut_out_background(); }, - $options: $choose_transparency + $options: $choose_transparency_unsupported }, { name: "Select", description: "Selects a rectangular part of the picture to move, copy, or edit.", @@ -164,7 +164,7 @@ tools = [{ selection.destroy(); selection = null; }, - $options: $choose_transparency + $options: $choose_transparency_unsupported }, { name: "Eraser/Color Eraser", description: "Erases a portion of the picture, using the selected eraser shape.",