minecraft characters.

This commit is contained in:
2026-08-28 19:30:47 +08:00
parent 9422bdc5c8
commit 9d695e704e
16 changed files with 964 additions and 52 deletions
+9 -2
View File
@@ -11,14 +11,14 @@ use tauri_specta::Event;
use tokio::sync::mpsc;
use tokio::sync::watch;
#[derive(Debug, Clone, Serialize, Deserialize, Default, Type)]
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Type)]
#[serde(rename_all = "camelCase")]
pub struct CursorPosition {
pub x: f64,
pub y: f64,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default, Type)]
#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Type)]
#[serde(rename_all = "camelCase")]
pub struct CursorPositions {
/// Absolute cursor coordinates in physical pixels.
@@ -56,6 +56,13 @@ impl CursorState {
positions_by_user.retain(|user_id, _| !user_ids.contains(user_id));
Ok((positions_by_user.len() != previous_len).then(|| positions_by_user.clone()))
}
pub(crate) fn snapshot(&self) -> Result<HashMap<String, CursorPositions>, String> {
self.0
.read()
.map(|positions| positions.clone())
.map_err(|error| error.to_string())
}
}
// Was private, but for some reason LSP