mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-08-03 06:38:52 +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>,
|
battery_status: Option<EnvisionBatteryStatus>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default)]
|
#[derive(Debug, Default, Clone)]
|
||||||
pub struct DeviceRowModelInit {
|
pub struct DeviceRowModelInit {
|
||||||
pub title: Option<String>,
|
pub title: Option<String>,
|
||||||
pub subtitle: Option<String>,
|
pub subtitle: Option<String>,
|
||||||
|
@ -74,7 +74,9 @@ impl From<&XRDevice> for DeviceRowModelInit {
|
||||||
.iter()
|
.iter()
|
||||||
.min()
|
.min()
|
||||||
.unwrap_or(&XRDeviceRole::GenericTracker)
|
.unwrap_or(&XRDeviceRole::GenericTracker)
|
||||||
.as_number(),
|
.as_number()
|
||||||
|
* 1000
|
||||||
|
+ d.index,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,7 +237,8 @@ impl From<DeviceRole> for XRDeviceRole {
|
||||||
pub struct XRDevice {
|
pub struct XRDevice {
|
||||||
pub roles: Vec<XRDeviceRole>,
|
pub roles: Vec<XRDeviceRole>,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub id: String,
|
pub id: u32,
|
||||||
|
pub index: u32,
|
||||||
pub serial: Option<String>,
|
pub serial: Option<String>,
|
||||||
pub battery: Option<BatteryStatus>,
|
pub battery: Option<BatteryStatus>,
|
||||||
}
|
}
|
||||||
|
@ -251,7 +252,8 @@ impl XRDevice {
|
||||||
(
|
(
|
||||||
dev.index,
|
dev.index,
|
||||||
Self {
|
Self {
|
||||||
id: dev.id.to_string(),
|
id: dev.id,
|
||||||
|
index: dev.index,
|
||||||
serial: dev.serial().ok(),
|
serial: dev.serial().ok(),
|
||||||
battery: dev.battery_status().ok().and_then(|bs| {
|
battery: dev.battery_status().ok().and_then(|bs| {
|
||||||
if bs.present {
|
if bs.present {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue