All checks were successful
/ test (push) Successful in 2m20s
Adds a continuous integration workflow to the repository, using the [Forgejo Actions](https://forgejo.org/docs/next/user/actions/) framework. Concurrently, Aaron added a [wiki page](https://code.studioinfinity.org/glen/dyna3/wiki/Continuous-integration) to document the continuous integration system. In particular, this page explains how to [run continuous integration checks on a development machine](wiki/Continuous-integration#execution), either directly or in a container. Co-authored-by: Aaron Fenyes <aaron.fenyes@fareycircles.ooo> Co-authored-by: Glen Whitney <glen@studioinfinity.org> Reviewed-on: #75 Co-authored-by: Vectornaut <vectornaut@nobody@nowhere.net> Co-committed-by: Vectornaut <vectornaut@nobody@nowhere.net>
68 lines
No EOL
1.5 KiB
Rust
68 lines
No EOL
1.5 KiB
Rust
mod add_remove;
|
|
mod assembly;
|
|
mod display;
|
|
mod engine;
|
|
mod outline;
|
|
mod specified;
|
|
|
|
#[cfg(test)]
|
|
mod tests;
|
|
|
|
use rustc_hash::FxHashSet;
|
|
use sycamore::prelude::*;
|
|
|
|
use add_remove::AddRemove;
|
|
use assembly::{Assembly, ElementKey};
|
|
use display::Display;
|
|
use outline::Outline;
|
|
|
|
#[derive(Clone)]
|
|
struct AppState {
|
|
assembly: Assembly,
|
|
selection: Signal<FxHashSet<ElementKey>>
|
|
}
|
|
|
|
impl AppState {
|
|
fn new() -> AppState {
|
|
AppState {
|
|
assembly: Assembly::new(),
|
|
selection: create_signal(FxHashSet::default())
|
|
}
|
|
}
|
|
|
|
// in single-selection mode, select the element with the given key. in
|
|
// multiple-selection mode, toggle whether the element with the given key
|
|
// is selected
|
|
fn select(&self, key: ElementKey, multi: bool) {
|
|
if multi {
|
|
self.selection.update(|sel| {
|
|
if !sel.remove(&key) {
|
|
sel.insert(key);
|
|
}
|
|
});
|
|
} else {
|
|
self.selection.update(|sel| {
|
|
sel.clear();
|
|
sel.insert(key);
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
// set the console error panic hook
|
|
#[cfg(feature = "console_error_panic_hook")]
|
|
console_error_panic_hook::set_once();
|
|
|
|
sycamore::render(|| {
|
|
provide_context(AppState::new());
|
|
|
|
view! {
|
|
div(id="sidebar") {
|
|
AddRemove {}
|
|
Outline {}
|
|
}
|
|
Display {}
|
|
}
|
|
});
|
|
} |