mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-04-19 19:14:53 +00:00
fix: add xr device index to sort index to try and keep the order consistent
This commit is contained in:
parent
aa7f3ec0c4
commit
76d71cb0c2
2 changed files with 8 additions and 4 deletions
|
@ -45,7 +45,7 @@ pub struct DeviceRowModel {
|
|||
battery_status: Option<EnvisionBatteryStatus>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
#[derive(Debug, Default, Clone)]
|
||||
pub struct DeviceRowModelInit {
|
||||
pub title: Option<String>,
|
||||
pub subtitle: Option<String>,
|
||||
|
@ -74,7 +74,9 @@ impl From<&XRDevice> for DeviceRowModelInit {
|
|||
.iter()
|
||||
.min()
|
||||
.unwrap_or(&XRDeviceRole::GenericTracker)
|
||||
.as_number(),
|
||||
.as_number()
|
||||
* 1000
|
||||
+ d.index,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -237,7 +237,8 @@ impl From<DeviceRole> for XRDeviceRole {
|
|||
pub struct XRDevice {
|
||||
pub roles: Vec<XRDeviceRole>,
|
||||
pub name: String,
|
||||
pub id: String,
|
||||
pub id: u32,
|
||||
pub index: u32,
|
||||
pub serial: Option<String>,
|
||||
pub battery: Option<BatteryStatus>,
|
||||
}
|
||||
|
@ -251,7 +252,8 @@ impl XRDevice {
|
|||
(
|
||||
dev.index,
|
||||
Self {
|
||||
id: dev.id.to_string(),
|
||||
id: dev.id,
|
||||
index: dev.index,
|
||||
serial: dev.serial().ok(),
|
||||
battery: dev.battery_status().ok().and_then(|bs| {
|
||||
if bs.present {
|
||||
|
|
Loading…
Add table
Reference in a new issue