notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit 3f350819cda869759cc673bbe75f06abddc72f62
parent dacce6bc90bb88ed411d6cb0fd97a7b8e1c36afe
Author: William Casarin <jb55@jb55.com>
Date:   Fri, 27 Feb 2026 10:07:41 -0800

nostrverse: add reset button and richer demo tilemap

Add ResetSpace action with a Reset button next to Save in the editing
panel. Expand DEMO_SPACE tileset to 7 tile types (grass, stone, water,
sand, dirt, snow, wood) with a painted 10x10 grid.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Diffstat:
Mcrates/notedeck_nostrverse/src/lib.rs | 11+++++++++--
Mcrates/notedeck_nostrverse/src/room_state.rs | 2++
Mcrates/notedeck_nostrverse/src/room_view.rs | 21+++++++++++++--------
3 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/crates/notedeck_nostrverse/src/lib.rs b/crates/notedeck_nostrverse/src/lib.rs @@ -97,8 +97,8 @@ const MAX_EXTRAPOLATION_DISTANCE: f32 = 10.0; const DEMO_SPACE: &str = r#"(space (name "Demo Space") (group (tilemap (width 10) (height 10) - (tileset "grass") - (data "0")) + (tileset "grass" "stone" "water" "sand" "dirt" "snow" "wood") + (data "0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 4 4 4 0 0 1 1 1 0 0 4 4 4 0 0 0 0 0 0 0 0 0 0 0 3 3 3 0 0 0 0 5 5 5 3 3 3 0 0 0 0 5 5 5 0 0 0 0 2 2 0 0 0 0 0 0 0 0 2 2 0 0 0 0 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6")) (table (id obj1) (name "Ironwood Table") (model-url "/home/jb55/var/models/ironwood/ironwood.glb") (position 0 0 0)) @@ -760,6 +760,13 @@ impl NostrverseApp { self.state.dirty = true; } } + NostrverseAction::ResetSpace => { + if let Ok(space) = protoverse::parse(DEMO_SPACE) { + self.apply_space(&space); + self.save_space(ctx); + self.state.dirty = false; + } + } NostrverseAction::DuplicateObject(id) => { let Some(src) = self.state.objects.iter().find(|o| o.id == id).cloned() else { return; diff --git a/crates/notedeck_nostrverse/src/room_state.rs b/crates/notedeck_nostrverse/src/room_state.rs @@ -21,6 +21,8 @@ pub enum NostrverseAction { DuplicateObject(String), /// Object was rotated (id, new rotation) RotateObject { id: String, rotation: Quat }, + /// Reset scene to the default demo space + ResetSpace, } /// Reference to a nostrverse space diff --git a/crates/notedeck_nostrverse/src/room_view.rs b/crates/notedeck_nostrverse/src/room_view.rs @@ -714,16 +714,21 @@ pub fn render_editing_panel(ui: &mut Ui, state: &mut NostrverseState) -> Option< ui.add_space(8.0); render_grid_snap_controls(ui, state); - // --- Save button --- + // --- Save / Reset buttons --- ui.add_space(12.0); ui.separator(); - let save_label = if state.dirty { "Save *" } else { "Save" }; - if ui - .add_enabled(state.dirty, egui::Button::new(save_label)) - .clicked() - { - action = Some(NostrverseAction::SaveSpace); - } + ui.horizontal(|ui| { + let save_label = if state.dirty { "Save *" } else { "Save" }; + if ui + .add_enabled(state.dirty, egui::Button::new(save_label)) + .clicked() + { + action = Some(NostrverseAction::SaveSpace); + } + if ui.button("Reset").clicked() { + action = Some(NostrverseAction::ResetSpace); + } + }); // --- Scene body --- render_scene_preview(ui, state);