image enhancement reset button

This commit is contained in:
Bala Clark 2011-08-30 23:55:22 +02:00
parent 41626d8ab7
commit 1403e1e01c

View file

@ -178,8 +178,8 @@ function ComicBook(id, srcs, opts) {
ComicBook.prototype.enhance.brightness({ contrast: ui.value }); ComicBook.prototype.enhance.brightness({ contrast: ui.value });
} }
})) }))
.append("<input type='checkbox' id='desaturate' />") .append("<input type='checkbox' id='desaturate' /> <label for='desaturate'>Desaturate</label>")
.append("<label for='desaturate'>Desaturate</label>") .append("<button id='reset' style='display:block'>reset</button>")
.css({ .css({
position: "absolute", position: "absolute",
top: "40%", top: "40%",
@ -217,12 +217,21 @@ function ComicBook(id, srcs, opts) {
.after(this.getControl("image").hide()); .after(this.getControl("image").hide());
$("#desaturate").click(function(e){ $("#desaturate").click(function(e){
if (this.checked) { if ($(this).is(":checked")) {
ComicBook.prototype.enhance.desaturate(); ComicBook.prototype.enhance.desaturate();
} else { } else {
ComicBook.prototype.enhance.resaturate(); ComicBook.prototype.enhance.resaturate();
} }
}) });
$("#reset").click(function(e){
// TODO: improve performance here.
$("#brightness").slider("value", 0)
$("#saturation").slider("value", 0);
var desaturate = $("#desaturate");
desaturate.attr("checked", !desaturate.attr("checked"));
ComicBook.prototype.enhance.reset();
});
}; };
ComicBook.prototype.getControl = function(control) { ComicBook.prototype.getControl = function(control) {