This commit is contained in:
Max Bradbury 2020-11-17 10:10:07 +00:00
parent 47a9bf5c79
commit 63bcf8532c
3 changed files with 14 additions and 0 deletions

View File

@ -78,6 +78,11 @@ html(lang="en-gb")
| dither | dither
br br
label
input#filter(type="checkbox")
| filter
br
button.pagination.prev#back-to-image previous button.pagination.prev#back-to-image previous
button.pagination.next#room-next add room button.pagination.next#room-next add room
.page.download .page.download

View File

@ -8,6 +8,7 @@ import init, {
output, output,
set_brightness, set_brightness,
set_dither, set_dither,
set_filter,
set_palette, set_palette,
set_room_name, set_room_name,
} from './pkg/pixsy.js'; } from './pkg/pixsy.js';

View File

@ -33,6 +33,7 @@ struct State {
room_name: Option<String>, room_name: Option<String>,
palette: SelectedPalette, palette: SelectedPalette,
dither: bool, dither: bool,
filter: bool,
brightness: i32, brightness: i32,
} }
@ -44,6 +45,7 @@ lazy_static! {
room_name: None, room_name: None,
palette: SelectedPalette::None, palette: SelectedPalette::None,
dither: true, dither: true,
filter: false,
brightness: 0, brightness: 0,
} }
); );
@ -131,6 +133,12 @@ pub fn set_dither(dither: bool) {
state.dither = dither; state.dither = dither;
} }
#[wasm_bindgen]
pub fn set_filter(filter: bool) {
let mut state = STATE.lock().unwrap();
state.filter = filter;
}
#[wasm_bindgen] #[wasm_bindgen]
pub fn set_palette(palette_id: &str, background: String, foreground: String) { pub fn set_palette(palette_id: &str, background: String, foreground: String) {
let mut state = STATE.lock().unwrap(); let mut state = STATE.lock().unwrap();