From 63bcf8532c8c8e7aa00d885de7c1e818a508a264 Mon Sep 17 00:00:00 2001 From: Max Bradbury Date: Tue, 17 Nov 2020 10:10:07 +0000 Subject: [PATCH] wip --- index.pug | 5 +++++ script.js | 1 + src/lib.rs | 8 ++++++++ 3 files changed, 14 insertions(+) diff --git a/index.pug b/index.pug index 27f4c8d..a333c95 100644 --- a/index.pug +++ b/index.pug @@ -78,6 +78,11 @@ html(lang="en-gb") | dither br + label + input#filter(type="checkbox") + | filter + br + button.pagination.prev#back-to-image previous button.pagination.next#room-next add room .page.download diff --git a/script.js b/script.js index 2904330..e73ce4a 100644 --- a/script.js +++ b/script.js @@ -8,6 +8,7 @@ import init, { output, set_brightness, set_dither, + set_filter, set_palette, set_room_name, } from './pkg/pixsy.js'; diff --git a/src/lib.rs b/src/lib.rs index b6178a1..c63397c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -33,6 +33,7 @@ struct State { room_name: Option, palette: SelectedPalette, dither: bool, + filter: bool, brightness: i32, } @@ -44,6 +45,7 @@ lazy_static! { room_name: None, palette: SelectedPalette::None, dither: true, + filter: false, brightness: 0, } ); @@ -131,6 +133,12 @@ pub fn set_dither(dither: bool) { state.dither = dither; } +#[wasm_bindgen] +pub fn set_filter(filter: bool) { + let mut state = STATE.lock().unwrap(); + state.filter = filter; +} + #[wasm_bindgen] pub fn set_palette(palette_id: &str, background: String, foreground: String) { let mut state = STATE.lock().unwrap();