feat: newer input system
This commit is contained in:
888
Cargo.lock
generated
888
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -7,8 +7,8 @@ serde = "1.0.197"
|
|||||||
|
|
||||||
[workspace.dependencies.stardust-xr-fusion]
|
[workspace.dependencies.stardust-xr-fusion]
|
||||||
git = "https://github.com/StardustXR/core.git"
|
git = "https://github.com/StardustXR/core.git"
|
||||||
# path = "../../core/fusion"
|
branch = "dev"
|
||||||
|
|
||||||
[workspace.dependencies.stardust-xr-molecules]
|
[workspace.dependencies.stardust-xr-molecules]
|
||||||
git = "https://github.com/StardustXR/molecules.git"
|
git = "https://github.com/StardustXR/molecules.git"
|
||||||
# path = "../../molecules"
|
branch = "dev"
|
||||||
|
|||||||
@@ -12,11 +12,5 @@ manifest-dir-macros = "0.1.18"
|
|||||||
glam = "0.24.2"
|
glam = "0.24.2"
|
||||||
tween = "2.0.1"
|
tween = "2.0.1"
|
||||||
tracing-subscriber = "0.3.17"
|
tracing-subscriber = "0.3.17"
|
||||||
|
stardust-xr-fusion = { workspace = true }
|
||||||
[dependencies.stardust-xr-fusion]
|
stardust-xr-molecules = { workspace = true }
|
||||||
git = "https://github.com/StardustXR/core.git"
|
|
||||||
# path = "../../core/fusion"
|
|
||||||
|
|
||||||
[dependencies.stardust-xr-molecules]
|
|
||||||
git = "https://github.com/StardustXR/molecules.git"
|
|
||||||
# path = "../../molecules"
|
|
||||||
|
|||||||
@@ -6,14 +6,15 @@ use protostar::{
|
|||||||
xdg::{get_desktop_files, parse_desktop_file, DesktopFile, Icon, IconType},
|
xdg::{get_desktop_files, parse_desktop_file, DesktopFile, Icon, IconType},
|
||||||
};
|
};
|
||||||
use stardust_xr_fusion::{
|
use stardust_xr_fusion::{
|
||||||
client::{Client, ClientState, FrameInfo, RootHandler},
|
client::Client,
|
||||||
core::values::{color::rgba_linear, ResourceID, Vector3},
|
core::values::{color::rgba_linear, ResourceID, Vector3},
|
||||||
drawable::{
|
drawable::{
|
||||||
MaterialParameter, Model, ModelPartAspect, Text, TextBounds, TextFit, TextStyle, XAlign,
|
MaterialParameter, Model, ModelPartAspect, Text, TextBounds, TextFit, TextStyle, XAlign,
|
||||||
YAlign,
|
YAlign,
|
||||||
},
|
},
|
||||||
fields::BoxField,
|
fields::{Field, Shape},
|
||||||
node::NodeType,
|
node::NodeType,
|
||||||
|
root::{ClientState, FrameInfo, RootAspect, RootHandler},
|
||||||
spatial::{Spatial, SpatialAspect, SpatialRefAspect, Transform},
|
spatial::{Spatial, SpatialAspect, SpatialRefAspect, Transform},
|
||||||
};
|
};
|
||||||
use stardust_xr_molecules::{Grabbable, GrabbableSettings};
|
use stardust_xr_molecules::{Grabbable, GrabbableSettings};
|
||||||
@@ -32,9 +33,11 @@ async fn main() -> Result<()> {
|
|||||||
.pretty()
|
.pretty()
|
||||||
.init();
|
.init();
|
||||||
let (client, event_loop) = Client::connect_with_async_loop().await?;
|
let (client, event_loop) = Client::connect_with_async_loop().await?;
|
||||||
client.set_base_prefixes(&[directory_relative_path!("../res")]);
|
client
|
||||||
|
.set_base_prefixes(&[directory_relative_path!("../res")])
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
let _root = client.wrap_root(AppGrid::new(&client))?;
|
let _root = client.get_root().alias().wrap(AppGrid::new(&client))?;
|
||||||
|
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
_ = tokio::signal::ctrl_c() => (),
|
_ = tokio::signal::ctrl_c() => (),
|
||||||
@@ -44,7 +47,6 @@ async fn main() -> Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct AppGrid {
|
struct AppGrid {
|
||||||
root: Spatial,
|
|
||||||
apps: Vec<App>,
|
apps: Vec<App>,
|
||||||
//style: TextStyle,
|
//style: TextStyle,
|
||||||
}
|
}
|
||||||
@@ -69,20 +71,17 @@ impl AppGrid {
|
|||||||
.ok()
|
.ok()
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
AppGrid {
|
AppGrid { apps }
|
||||||
root: client.get_root().alias(),
|
|
||||||
apps,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl RootHandler for AppGrid {
|
impl RootHandler for AppGrid {
|
||||||
fn frame(&mut self, info: FrameInfo) {
|
fn frame(&mut self, info: FrameInfo) {
|
||||||
for app in &mut self.apps {
|
for app in &mut self.apps {
|
||||||
app.frame(info);
|
app.frame(&info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn save_state(&mut self) -> ClientState {
|
fn save_state(&mut self) -> Result<ClientState> {
|
||||||
ClientState::from_root(&self.root)
|
Ok(ClientState::default())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,11 +98,11 @@ fn model_from_icon(parent: &Spatial, icon: &Icon) -> Result<Model> {
|
|||||||
Transform::from_rotation(Quat::from_rotation_y(PI)),
|
Transform::from_rotation(Quat::from_rotation_y(PI)),
|
||||||
&ResourceID::new_namespaced("protostar", "cartridge"),
|
&ResourceID::new_namespaced("protostar", "cartridge"),
|
||||||
)?;
|
)?;
|
||||||
model.model_part("Cartridge")?.set_material_parameter(
|
model.part("Cartridge")?.set_material_parameter(
|
||||||
"color",
|
"color",
|
||||||
MaterialParameter::Color(rgba_linear!(0.0, 1.0, 1.0, 1.0)),
|
MaterialParameter::Color(rgba_linear!(0.0, 1.0, 1.0, 1.0)),
|
||||||
)?;
|
)?;
|
||||||
model.model_part("Icon")?.set_material_parameter(
|
model.part("Icon")?.set_material_parameter(
|
||||||
"diffuse",
|
"diffuse",
|
||||||
MaterialParameter::Texture(ResourceID::Direct(icon.path.clone())),
|
MaterialParameter::Texture(ResourceID::Direct(icon.path.clone())),
|
||||||
)?;
|
)?;
|
||||||
@@ -122,18 +121,18 @@ pub struct App {
|
|||||||
root: Spatial,
|
root: Spatial,
|
||||||
application: Application,
|
application: Application,
|
||||||
grabbable: Grabbable,
|
grabbable: Grabbable,
|
||||||
_field: BoxField,
|
_field: Field,
|
||||||
_icon: Model,
|
_icon: Model,
|
||||||
_label: Option<Text>,
|
_label: Option<Text>,
|
||||||
}
|
}
|
||||||
impl App {
|
impl App {
|
||||||
pub fn create_from_desktop_file(
|
pub fn create_from_desktop_file(
|
||||||
parent: &impl SpatialAspect,
|
parent: &impl SpatialRefAspect,
|
||||||
position: impl Into<Vector3<f32>>,
|
position: impl Into<Vector3<f32>>,
|
||||||
desktop_file: DesktopFile,
|
desktop_file: DesktopFile,
|
||||||
) -> Result<Self> {
|
) -> Result<Self> {
|
||||||
let root = Spatial::create(parent, Transform::from_translation(position), false)?;
|
let root = Spatial::create(parent, Transform::from_translation(position), false)?;
|
||||||
let field = BoxField::create(&root, Transform::none(), [APP_SIZE; 3])?;
|
let field = Field::create(&root, Transform::none(), Shape::Box([APP_SIZE; 3].into()))?;
|
||||||
let application = Application::create(desktop_file)?;
|
let application = Application::create(desktop_file)?;
|
||||||
let icon = application.icon(128, true);
|
let icon = application.icon(128, true);
|
||||||
let grabbable = Grabbable::create(
|
let grabbable = Grabbable::create(
|
||||||
@@ -171,7 +170,7 @@ impl App {
|
|||||||
};
|
};
|
||||||
let label = application.name().and_then(|name| {
|
let label = application.name().and_then(|name| {
|
||||||
Text::create(
|
Text::create(
|
||||||
&icon.model_part("Label").ok()?,
|
&icon.part("Label").ok()?,
|
||||||
Transform::none(),
|
Transform::none(),
|
||||||
name,
|
name,
|
||||||
label_style,
|
label_style,
|
||||||
@@ -198,7 +197,7 @@ impl App {
|
|||||||
// .unwrap();
|
// .unwrap();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
fn frame(&mut self, info: FrameInfo) {
|
fn frame(&mut self, info: &FrameInfo) {
|
||||||
let _ = self.grabbable.update(&info);
|
let _ = self.grabbable.update(&info);
|
||||||
|
|
||||||
if self.grabbable.grab_action().actor_stopped() {
|
if self.grabbable.grab_action().actor_stopped() {
|
||||||
|
|||||||
Binary file not shown.
@@ -5,14 +5,14 @@ use protostar::{
|
|||||||
xdg::{DesktopFile, Icon, IconType},
|
xdg::{DesktopFile, Icon, IconType},
|
||||||
};
|
};
|
||||||
use stardust_xr_fusion::{
|
use stardust_xr_fusion::{
|
||||||
client::FrameInfo,
|
|
||||||
core::values::{ResourceID, Vector3},
|
core::values::{ResourceID, Vector3},
|
||||||
drawable::{
|
drawable::{
|
||||||
MaterialParameter, Model, ModelPartAspect, Text, TextBounds, TextFit, TextStyle, XAlign,
|
MaterialParameter, Model, ModelPartAspect, Text, TextBounds, TextFit, TextStyle, XAlign,
|
||||||
YAlign,
|
YAlign,
|
||||||
},
|
},
|
||||||
fields::BoxField,
|
fields::{Field, Shape},
|
||||||
node::NodeType,
|
node::NodeType,
|
||||||
|
root::FrameInfo,
|
||||||
spatial::{Spatial, SpatialAspect, SpatialRefAspect, Transform},
|
spatial::{Spatial, SpatialAspect, SpatialRefAspect, Transform},
|
||||||
};
|
};
|
||||||
use stardust_xr_molecules::{Grabbable, GrabbableSettings};
|
use stardust_xr_molecules::{Grabbable, GrabbableSettings};
|
||||||
@@ -36,9 +36,9 @@ fn model_from_icon(parent: &Spatial, icon: &Icon) -> Result<Model> {
|
|||||||
&ResourceID::new_namespaced("protostar", "hexagon/hexagon"),
|
&ResourceID::new_namespaced("protostar", "hexagon/hexagon"),
|
||||||
)?;
|
)?;
|
||||||
model
|
model
|
||||||
.model_part("Hex")?
|
.part("Hex")?
|
||||||
.set_material_parameter("color", MaterialParameter::Color(DEFAULT_HEX_COLOR))?;
|
.set_material_parameter("color", MaterialParameter::Color(DEFAULT_HEX_COLOR))?;
|
||||||
model.model_part("Icon")?.set_material_parameter(
|
model.part("Icon")?.set_material_parameter(
|
||||||
"diffuse",
|
"diffuse",
|
||||||
MaterialParameter::Texture(ResourceID::Direct(icon.path.clone())),
|
MaterialParameter::Texture(ResourceID::Direct(icon.path.clone())),
|
||||||
)?;
|
)?;
|
||||||
@@ -58,7 +58,7 @@ pub struct App {
|
|||||||
parent: Spatial,
|
parent: Spatial,
|
||||||
position: Vector3<f32>,
|
position: Vector3<f32>,
|
||||||
grabbable: Grabbable,
|
grabbable: Grabbable,
|
||||||
_field: BoxField,
|
_field: Field,
|
||||||
icon: Model,
|
icon: Model,
|
||||||
label: Option<Text>,
|
label: Option<Text>,
|
||||||
grabbable_shrink: Option<Tweener<f32, f64, QuartInOut>>,
|
grabbable_shrink: Option<Tweener<f32, f64, QuartInOut>>,
|
||||||
@@ -73,7 +73,11 @@ impl App {
|
|||||||
state: &State,
|
state: &State,
|
||||||
) -> Result<Self> {
|
) -> Result<Self> {
|
||||||
let position = position.into();
|
let position = position.into();
|
||||||
let field = BoxField::create(parent, Transform::identity(), [APP_SIZE; 3])?;
|
let field = Field::create(
|
||||||
|
parent,
|
||||||
|
Transform::identity(),
|
||||||
|
Shape::Box([APP_SIZE; 3].into()),
|
||||||
|
)?;
|
||||||
let application = Application::create(desktop_file)?;
|
let application = Application::create(desktop_file)?;
|
||||||
let icon = application.icon(128, false);
|
let icon = application.icon(128, false);
|
||||||
let grabbable = Grabbable::create(
|
let grabbable = Grabbable::create(
|
||||||
@@ -81,7 +85,7 @@ impl App {
|
|||||||
Transform::from_translation(position),
|
Transform::from_translation(position),
|
||||||
&field,
|
&field,
|
||||||
GrabbableSettings {
|
GrabbableSettings {
|
||||||
max_distance: 0.01,
|
max_distance: 0.025,
|
||||||
zoneable: false,
|
zoneable: false,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
@@ -167,12 +171,12 @@ impl App {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn frame(&mut self, info: FrameInfo, state: &State) {
|
pub fn frame(&mut self, info: &FrameInfo, state: &State) {
|
||||||
let _ = self.grabbable.update(&info);
|
let _ = self.grabbable.update(&info);
|
||||||
|
|
||||||
if let Some(grabbable_move) = &mut self.grabbable_move {
|
if let Some(grabbable_move) = &mut self.grabbable_move {
|
||||||
if !grabbable_move.is_finished() {
|
if !grabbable_move.is_finished() {
|
||||||
let scale = grabbable_move.move_by(info.delta);
|
let scale = grabbable_move.move_by(info.delta.into());
|
||||||
self.grabbable
|
self.grabbable
|
||||||
.content_parent()
|
.content_parent()
|
||||||
.set_relative_transform(
|
.set_relative_transform(
|
||||||
@@ -192,7 +196,7 @@ impl App {
|
|||||||
}
|
}
|
||||||
if let Some(grabbable_shrink) = &mut self.grabbable_shrink {
|
if let Some(grabbable_shrink) = &mut self.grabbable_shrink {
|
||||||
if !grabbable_shrink.is_finished() {
|
if !grabbable_shrink.is_finished() {
|
||||||
let scale = grabbable_shrink.move_by(info.delta);
|
let scale = grabbable_shrink.move_by(info.delta.into());
|
||||||
self.grabbable
|
self.grabbable
|
||||||
.content_parent()
|
.content_parent()
|
||||||
.set_relative_transform(&self.parent, Transform::from_scale([scale; 3]))
|
.set_relative_transform(&self.parent, Transform::from_scale([scale; 3]))
|
||||||
@@ -227,7 +231,7 @@ impl App {
|
|||||||
}
|
}
|
||||||
} else if let Some(grabbable_grow) = &mut self.grabbable_grow {
|
} else if let Some(grabbable_grow) = &mut self.grabbable_grow {
|
||||||
if !grabbable_grow.is_finished() {
|
if !grabbable_grow.is_finished() {
|
||||||
let scale = grabbable_grow.move_by(info.delta);
|
let scale = grabbable_grow.move_by(info.delta.into());
|
||||||
self.grabbable
|
self.grabbable
|
||||||
.content_parent()
|
.content_parent()
|
||||||
.set_relative_transform(&self.parent, Transform::from_scale([scale; 3]))
|
.set_relative_transform(&self.parent, Transform::from_scale([scale; 3]))
|
||||||
|
|||||||
@@ -9,23 +9,21 @@ use manifest_dir_macros::directory_relative_path;
|
|||||||
use protostar::xdg::{get_desktop_files, parse_desktop_file, DesktopFile};
|
use protostar::xdg::{get_desktop_files, parse_desktop_file, DesktopFile};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use stardust_xr_fusion::{
|
use stardust_xr_fusion::{
|
||||||
client::{Client, ClientState, FrameInfo, RootHandler},
|
client::Client,
|
||||||
core::{
|
core::values::{
|
||||||
schemas::flex::flexbuffers,
|
|
||||||
values::{
|
|
||||||
color::{color_space::LinearRgb, rgba_linear, Rgba},
|
color::{color_space::LinearRgb, rgba_linear, Rgba},
|
||||||
ResourceID,
|
ResourceID,
|
||||||
},
|
},
|
||||||
},
|
|
||||||
drawable::{MaterialParameter, Model, ModelPartAspect},
|
drawable::{MaterialParameter, Model, ModelPartAspect},
|
||||||
node::{NodeError, NodeType},
|
node::{NodeError, NodeType},
|
||||||
|
root::{ClientState, FrameInfo, RootAspect, RootHandler},
|
||||||
spatial::{Spatial, SpatialAspect, Transform},
|
spatial::{Spatial, SpatialAspect, Transform},
|
||||||
};
|
};
|
||||||
use stardust_xr_molecules::{
|
use stardust_xr_molecules::{
|
||||||
button::{Button, ButtonSettings},
|
button::{Button, ButtonSettings},
|
||||||
Grabbable, GrabbableSettings, PointerMode,
|
Grabbable, GrabbableSettings, PointerMode,
|
||||||
};
|
};
|
||||||
use std::{f32::consts::PI, time::Duration};
|
use std::{f32::consts::PI, sync::Arc, time::Duration};
|
||||||
|
|
||||||
const APP_SIZE: f32 = 0.06;
|
const APP_SIZE: f32 = 0.06;
|
||||||
const PADDING: f32 = 0.005;
|
const PADDING: f32 = 0.005;
|
||||||
@@ -44,9 +42,14 @@ async fn main() -> Result<()> {
|
|||||||
.pretty()
|
.pretty()
|
||||||
.init();
|
.init();
|
||||||
let (client, event_loop) = Client::connect_with_async_loop().await?;
|
let (client, event_loop) = Client::connect_with_async_loop().await?;
|
||||||
client.set_base_prefixes(&[directory_relative_path!("../res")]);
|
client
|
||||||
|
.set_base_prefixes(&[directory_relative_path!("../res")])
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
let _root = client.wrap_root(AppHexGrid::new(&client).await)?;
|
let _root = client
|
||||||
|
.get_root()
|
||||||
|
.alias()
|
||||||
|
.wrap(AppHexGrid::new(&client).await)?;
|
||||||
|
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
_ = tokio::signal::ctrl_c() => (),
|
_ = tokio::signal::ctrl_c() => (),
|
||||||
@@ -55,7 +58,7 @@ async fn main() -> Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Serialize, Deserialize)]
|
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
|
||||||
pub struct State {
|
pub struct State {
|
||||||
unfurled: bool,
|
unfurled: bool,
|
||||||
}
|
}
|
||||||
@@ -67,13 +70,13 @@ struct AppHexGrid {
|
|||||||
state: State,
|
state: State,
|
||||||
}
|
}
|
||||||
impl AppHexGrid {
|
impl AppHexGrid {
|
||||||
async fn new(client: &Client) -> Self {
|
async fn new(client: &Arc<Client>) -> Self {
|
||||||
let state = flexbuffers::from_slice(&client.state().data).unwrap_or_default();
|
let state = client.get_state().data().unwrap_or_default();
|
||||||
|
|
||||||
let movable_root =
|
let movable_root =
|
||||||
Spatial::create(client.get_root(), Transform::identity(), false).unwrap();
|
Spatial::create(client.get_root(), Transform::identity(), false).unwrap();
|
||||||
|
|
||||||
let button = CenterButton::new(client, &client.state()).unwrap();
|
let button = CenterButton::new(client, &client.get_state()).unwrap();
|
||||||
tokio::time::sleep(Duration::from_millis(10)).await; // give it a bit of time to send the messages properly
|
tokio::time::sleep(Duration::from_millis(10)).await; // give it a bit of time to send the messages properly
|
||||||
|
|
||||||
let mut desktop_files: Vec<DesktopFile> = get_desktop_files()
|
let mut desktop_files: Vec<DesktopFile> = get_desktop_files()
|
||||||
@@ -119,11 +122,11 @@ impl AppHexGrid {
|
|||||||
}
|
}
|
||||||
impl RootHandler for AppHexGrid {
|
impl RootHandler for AppHexGrid {
|
||||||
fn frame(&mut self, info: FrameInfo) {
|
fn frame(&mut self, info: FrameInfo) {
|
||||||
self.button.frame(info);
|
self.button.frame(&info);
|
||||||
if self.button.button.pressed() {
|
if self.button.button.pressed() {
|
||||||
self.button
|
self.button
|
||||||
.model
|
.model
|
||||||
.model_part("Hex")
|
.part("Hex")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.set_material_parameter("color", MaterialParameter::Color(BTN_SELECTED_COLOR))
|
.set_material_parameter("color", MaterialParameter::Color(BTN_SELECTED_COLOR))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@@ -134,33 +137,33 @@ impl RootHandler for AppHexGrid {
|
|||||||
} else if self.button.button.released() {
|
} else if self.button.button.released() {
|
||||||
self.button
|
self.button
|
||||||
.model
|
.model
|
||||||
.model_part("Hex")
|
.part("Hex")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.set_material_parameter("color", MaterialParameter::Color(BTN_COLOR))
|
.set_material_parameter("color", MaterialParameter::Color(BTN_COLOR))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
for app in &mut self.apps {
|
for app in &mut self.apps {
|
||||||
app.frame(info, &self.state);
|
app.frame(&info, &self.state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn save_state(&mut self) -> ClientState {
|
fn save_state(&mut self) -> Result<ClientState> {
|
||||||
self.movable_root
|
self.movable_root
|
||||||
.set_relative_transform(
|
.set_relative_transform(
|
||||||
self.button.grabbable.content_parent(),
|
self.button.grabbable.content_parent(),
|
||||||
Transform::from_translation([0.0; 3]),
|
Transform::from_translation([0.0; 3]),
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
ClientState {
|
ClientState::new(
|
||||||
data: flexbuffers::to_vec(&self.state).unwrap(),
|
Some(self.state.clone()),
|
||||||
root: self.movable_root.alias(),
|
&self.movable_root,
|
||||||
spatial_anchors: [(
|
[(
|
||||||
"content_parent".to_string(),
|
"content_parent".to_string(),
|
||||||
self.button.grabbable.content_parent().alias(),
|
self.button.grabbable.content_parent(),
|
||||||
)]
|
)]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.collect(),
|
.collect(),
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,7 +173,7 @@ struct CenterButton {
|
|||||||
model: Model,
|
model: Model,
|
||||||
}
|
}
|
||||||
impl CenterButton {
|
impl CenterButton {
|
||||||
fn new(client: &Client, state: &ClientState) -> Result<Self, NodeError> {
|
fn new(client: &Arc<Client>, state: &ClientState) -> Result<Self, NodeError> {
|
||||||
// (APP_SIZE + PADDING) / 2.0,
|
// (APP_SIZE + PADDING) / 2.0,
|
||||||
let button = Button::create(
|
let button = Button::create(
|
||||||
client.get_root(),
|
client.get_root(),
|
||||||
@@ -206,9 +209,9 @@ impl CenterButton {
|
|||||||
&ResourceID::new_namespaced("protostar", "hexagon/hexagon"),
|
&ResourceID::new_namespaced("protostar", "hexagon/hexagon"),
|
||||||
)?;
|
)?;
|
||||||
model
|
model
|
||||||
.model_part("Hex")?
|
.part("Hex")?
|
||||||
.set_material_parameter("color", MaterialParameter::Color(BTN_COLOR))?;
|
.set_material_parameter("color", MaterialParameter::Color(BTN_COLOR))?;
|
||||||
if let Some(content_parent) = state.spatial_anchors.get("content_parent") {
|
if let Some(content_parent) = state.spatial_anchors(client).get("content_parent") {
|
||||||
grabbable
|
grabbable
|
||||||
.content_parent()
|
.content_parent()
|
||||||
.set_relative_transform(content_parent, Transform::identity())?;
|
.set_relative_transform(content_parent, Transform::identity())?;
|
||||||
@@ -220,7 +223,7 @@ impl CenterButton {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn frame(&mut self, info: FrameInfo) {
|
fn frame(&mut self, info: &FrameInfo) {
|
||||||
let _ = self.grabbable.update(&info);
|
let _ = self.grabbable.update(&info);
|
||||||
self.button.update();
|
self.button.update();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ use crate::xdg::{DesktopFile, Icon, IconType};
|
|||||||
use nix::libc::setsid;
|
use nix::libc::setsid;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use stardust_xr_fusion::{
|
use stardust_xr_fusion::{
|
||||||
client::ClientState,
|
node::{NodeError, NodeResult},
|
||||||
node::{NodeError, NodeType},
|
root::{ClientState, RootAspect},
|
||||||
spatial::Spatial,
|
spatial::SpatialRefAspect,
|
||||||
};
|
};
|
||||||
use std::{
|
use std::{
|
||||||
os::unix::process::CommandExt,
|
os::unix::process::CommandExt,
|
||||||
@@ -44,7 +44,7 @@ impl Application {
|
|||||||
icon.and_then(|i| i.cached_process(preferred_px_size).ok())
|
icon.and_then(|i| i.cached_process(preferred_px_size).ok())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn launch(&self, launch_space: &Spatial) -> Result<(), NodeError> {
|
pub fn launch(&self, launch_space: &impl SpatialRefAspect) -> NodeResult<()> {
|
||||||
let client = launch_space.node().client()?;
|
let client = launch_space.node().client()?;
|
||||||
let launch_space = launch_space.alias();
|
let launch_space = launch_space.alias();
|
||||||
|
|
||||||
@@ -55,16 +55,14 @@ impl Application {
|
|||||||
.ok_or(NodeError::DoesNotExist)?;
|
.ok_or(NodeError::DoesNotExist)?;
|
||||||
tokio::task::spawn(async move {
|
tokio::task::spawn(async move {
|
||||||
let Ok(startup_token) = client
|
let Ok(startup_token) = client
|
||||||
.state_token(&ClientState::from_root(&launch_space))
|
.get_root()
|
||||||
|
.generate_state_token(ClientState::from_root(&launch_space).unwrap())
|
||||||
.await
|
.await
|
||||||
else {
|
else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
let Ok(future_connection_env) = client.get_connection_environment() else {
|
let Ok(connection_env) = client.get_root().get_connection_environment().await else {
|
||||||
return;
|
|
||||||
};
|
|
||||||
let Ok(connection_env) = future_connection_env.await else {
|
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
for (k, v) in connection_env.into_iter() {
|
for (k, v) in connection_env.into_iter() {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use clap::Parser;
|
|||||||
use color_eyre::{eyre::Result, Report};
|
use color_eyre::{eyre::Result, Report};
|
||||||
use manifest_dir_macros::directory_relative_path;
|
use manifest_dir_macros::directory_relative_path;
|
||||||
use protostar::xdg::parse_desktop_file;
|
use protostar::xdg::parse_desktop_file;
|
||||||
use stardust_xr_fusion::client::Client;
|
use stardust_xr_fusion::{client::Client, node::NodeType, root::RootAspect};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use tracing_subscriber::EnvFilter;
|
use tracing_subscriber::EnvFilter;
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ async fn main() -> Result<()> {
|
|||||||
color_eyre::install()?;
|
color_eyre::install()?;
|
||||||
let args = Args::parse();
|
let args = Args::parse();
|
||||||
let (client, event_loop) = Client::connect_with_async_loop().await?;
|
let (client, event_loop) = Client::connect_with_async_loop().await?;
|
||||||
client.set_base_prefixes(&[directory_relative_path!("../res")]);
|
client.set_base_prefixes(&[directory_relative_path!("../res")])?;
|
||||||
|
|
||||||
let protostar = Single::create_from_desktop_file(
|
let protostar = Single::create_from_desktop_file(
|
||||||
client.get_root(),
|
client.get_root(),
|
||||||
@@ -34,7 +34,7 @@ async fn main() -> Result<()> {
|
|||||||
parse_desktop_file(args.desktop_file).map_err(Report::msg)?,
|
parse_desktop_file(args.desktop_file).map_err(Report::msg)?,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let _root = client.wrap_root(protostar)?;
|
let _root = client.get_root().alias().wrap(protostar)?;
|
||||||
|
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
_ = tokio::signal::ctrl_c() => (),
|
_ = tokio::signal::ctrl_c() => (),
|
||||||
|
|||||||
@@ -5,14 +5,14 @@ use protostar::{
|
|||||||
xdg::{DesktopFile, Icon, IconType},
|
xdg::{DesktopFile, Icon, IconType},
|
||||||
};
|
};
|
||||||
use stardust_xr_fusion::{
|
use stardust_xr_fusion::{
|
||||||
client::{ClientState, FrameInfo, RootHandler},
|
|
||||||
core::values::{color::rgba_linear, ResourceID, Vector3},
|
core::values::{color::rgba_linear, ResourceID, Vector3},
|
||||||
drawable::{
|
drawable::{
|
||||||
MaterialParameter, Model, ModelPartAspect, Text, TextBounds, TextFit, TextStyle, XAlign,
|
MaterialParameter, Model, ModelPartAspect, Text, TextBounds, TextFit, TextStyle, XAlign,
|
||||||
YAlign,
|
YAlign,
|
||||||
},
|
},
|
||||||
fields::BoxField,
|
fields::{Field, Shape},
|
||||||
node::NodeType,
|
node::NodeType,
|
||||||
|
root::{ClientState, FrameInfo, RootHandler},
|
||||||
spatial::{Spatial, SpatialAspect, SpatialRefAspect, Transform},
|
spatial::{Spatial, SpatialAspect, SpatialRefAspect, Transform},
|
||||||
};
|
};
|
||||||
use stardust_xr_molecules::{Grabbable, GrabbableSettings};
|
use stardust_xr_molecules::{Grabbable, GrabbableSettings};
|
||||||
@@ -35,11 +35,11 @@ fn model_from_icon(parent: &Spatial, icon: &Icon) -> Result<Model> {
|
|||||||
t,
|
t,
|
||||||
&ResourceID::new_namespaced("protostar", "hexagon/hexagon"),
|
&ResourceID::new_namespaced("protostar", "hexagon/hexagon"),
|
||||||
)?;
|
)?;
|
||||||
model.model_part("Hex")?.set_material_parameter(
|
model.part("Hex")?.set_material_parameter(
|
||||||
"color",
|
"color",
|
||||||
MaterialParameter::Color(rgba_linear!(0.0, 1.0, 1.0, 1.0)),
|
MaterialParameter::Color(rgba_linear!(0.0, 1.0, 1.0, 1.0)),
|
||||||
)?;
|
)?;
|
||||||
model.model_part("Icon")?.set_material_parameter(
|
model.part("Icon")?.set_material_parameter(
|
||||||
"diffuse",
|
"diffuse",
|
||||||
MaterialParameter::Texture(ResourceID::Direct(icon.path.clone())),
|
MaterialParameter::Texture(ResourceID::Direct(icon.path.clone())),
|
||||||
)?;
|
)?;
|
||||||
@@ -59,7 +59,7 @@ pub struct Single {
|
|||||||
root: Spatial,
|
root: Spatial,
|
||||||
position: Vector3<f32>,
|
position: Vector3<f32>,
|
||||||
grabbable: Grabbable,
|
grabbable: Grabbable,
|
||||||
_field: BoxField,
|
_field: Field,
|
||||||
icon: Model,
|
icon: Model,
|
||||||
label: Option<Text>,
|
label: Option<Text>,
|
||||||
grabbable_shrink: Option<Tweener<f32, f64, QuartInOut>>,
|
grabbable_shrink: Option<Tweener<f32, f64, QuartInOut>>,
|
||||||
@@ -70,13 +70,17 @@ pub struct Single {
|
|||||||
|
|
||||||
impl Single {
|
impl Single {
|
||||||
pub fn create_from_desktop_file(
|
pub fn create_from_desktop_file(
|
||||||
parent: &impl SpatialAspect,
|
parent: &impl SpatialRefAspect,
|
||||||
position: impl Into<Vector3<f32>>,
|
position: impl Into<Vector3<f32>>,
|
||||||
desktop_file: DesktopFile,
|
desktop_file: DesktopFile,
|
||||||
) -> Result<Self> {
|
) -> Result<Self> {
|
||||||
let root = Spatial::create(parent, Transform::identity(), false)?;
|
let root = Spatial::create(parent, Transform::identity(), false)?;
|
||||||
let position = position.into();
|
let position = position.into();
|
||||||
let field = BoxField::create(&root, Transform::identity(), [MODEL_SCALE * 2.0; 3])?;
|
let field = Field::create(
|
||||||
|
&root,
|
||||||
|
Transform::identity(),
|
||||||
|
Shape::Box([MODEL_SCALE * 2.0; 3].into()),
|
||||||
|
)?;
|
||||||
let application = Application::create(desktop_file)?;
|
let application = Application::create(desktop_file)?;
|
||||||
let icon = application.icon(128, false);
|
let icon = application.icon(128, false);
|
||||||
let grabbable = Grabbable::create(
|
let grabbable = Grabbable::create(
|
||||||
@@ -148,7 +152,7 @@ impl RootHandler for Single {
|
|||||||
|
|
||||||
if let Some(grabbable_move) = &mut self.grabbable_move {
|
if let Some(grabbable_move) = &mut self.grabbable_move {
|
||||||
if !grabbable_move.is_finished() {
|
if !grabbable_move.is_finished() {
|
||||||
let scale = grabbable_move.move_by(info.delta);
|
let scale = grabbable_move.move_by(info.delta.into());
|
||||||
self.grabbable
|
self.grabbable
|
||||||
.content_parent()
|
.content_parent()
|
||||||
.set_relative_transform(
|
.set_relative_transform(
|
||||||
@@ -172,7 +176,7 @@ impl RootHandler for Single {
|
|||||||
}
|
}
|
||||||
if let Some(grabbable_shrink) = &mut self.grabbable_shrink {
|
if let Some(grabbable_shrink) = &mut self.grabbable_shrink {
|
||||||
if !grabbable_shrink.is_finished() {
|
if !grabbable_shrink.is_finished() {
|
||||||
let scale = grabbable_shrink.move_by(info.delta);
|
let scale = grabbable_shrink.move_by(info.delta.into());
|
||||||
self.grabbable
|
self.grabbable
|
||||||
.content_parent()
|
.content_parent()
|
||||||
.set_relative_transform(&self.root, Transform::from_scale([scale; 3]))
|
.set_relative_transform(&self.root, Transform::from_scale([scale; 3]))
|
||||||
@@ -204,7 +208,7 @@ impl RootHandler for Single {
|
|||||||
}
|
}
|
||||||
} else if let Some(grabbable_grow) = &mut self.grabbable_grow {
|
} else if let Some(grabbable_grow) = &mut self.grabbable_grow {
|
||||||
if !grabbable_grow.is_finished() {
|
if !grabbable_grow.is_finished() {
|
||||||
let scale = grabbable_grow.move_by(info.delta);
|
let scale = grabbable_grow.move_by(info.delta.into());
|
||||||
self.grabbable
|
self.grabbable
|
||||||
.content_parent()
|
.content_parent()
|
||||||
.set_relative_transform(&self.root, Transform::from_scale([scale; 3]))
|
.set_relative_transform(&self.root, Transform::from_scale([scale; 3]))
|
||||||
@@ -240,7 +244,7 @@ impl RootHandler for Single {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn save_state(&mut self) -> ClientState {
|
fn save_state(&mut self) -> color_eyre::eyre::Result<ClientState> {
|
||||||
ClientState::from_root(self.content_parent())
|
ClientState::from_root(self.content_parent())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,17 +8,15 @@ use protostar::{
|
|||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use stardust_xr_fusion::{
|
use stardust_xr_fusion::{
|
||||||
client::{Client, ClientState, FrameInfo, RootHandler},
|
client::Client,
|
||||||
core::{
|
core::values::{color::rgba_linear, ResourceID, Vector3},
|
||||||
schemas::flex::flexbuffers,
|
|
||||||
values::{color::rgba_linear, ResourceID, Vector3},
|
|
||||||
},
|
|
||||||
drawable::{
|
drawable::{
|
||||||
MaterialParameter, Model, ModelPartAspect, Text, TextBounds, TextFit, TextStyle, XAlign,
|
MaterialParameter, Model, ModelPartAspect, Text, TextBounds, TextFit, TextStyle, XAlign,
|
||||||
YAlign,
|
YAlign,
|
||||||
},
|
},
|
||||||
fields::BoxField,
|
fields::{Field, Shape},
|
||||||
node::{NodeError, NodeType},
|
node::{NodeError, NodeType},
|
||||||
|
root::{ClientState, FrameInfo, RootAspect, RootHandler},
|
||||||
spatial::{Spatial, SpatialAspect, SpatialRefAspect, Transform},
|
spatial::{Spatial, SpatialAspect, SpatialRefAspect, Transform},
|
||||||
};
|
};
|
||||||
use stardust_xr_molecules::{
|
use stardust_xr_molecules::{
|
||||||
@@ -53,9 +51,12 @@ async fn main() -> Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let (client, event_loop) = Client::connect_with_async_loop().await?;
|
let (client, event_loop) = Client::connect_with_async_loop().await?;
|
||||||
client.set_base_prefixes(&[directory_relative_path!("../res")]);
|
client.set_base_prefixes(&[directory_relative_path!("../res")])?;
|
||||||
|
|
||||||
let _wrapped_root = client.wrap_root(Sirius::new(&client, args)?)?;
|
let _wrapped_root = client
|
||||||
|
.get_root()
|
||||||
|
.alias()
|
||||||
|
.wrap(Sirius::new(&client, args)?)?;
|
||||||
|
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
_ = tokio::signal::ctrl_c() => (),
|
_ = tokio::signal::ctrl_c() => (),
|
||||||
@@ -64,7 +65,7 @@ async fn main() -> Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
struct State {
|
struct State {
|
||||||
visible: bool,
|
visible: bool,
|
||||||
}
|
}
|
||||||
@@ -80,7 +81,8 @@ impl Sirius {
|
|||||||
fn new(client: &Client, args: Args) -> Result<Self, NodeError> {
|
fn new(client: &Client, args: Args) -> Result<Self, NodeError> {
|
||||||
let root = Spatial::create(client.get_root(), Transform::identity(), false).unwrap();
|
let root = Spatial::create(client.get_root(), Transform::identity(), false).unwrap();
|
||||||
|
|
||||||
let field = BoxField::create(&root, Transform::identity(), [0.1; 3]).unwrap();
|
let field =
|
||||||
|
Field::create(&root, Transform::identity(), Shape::Box([0.1; 3].into())).unwrap();
|
||||||
let grabbable = Grabbable::create(
|
let grabbable = Grabbable::create(
|
||||||
&root,
|
&root,
|
||||||
Transform::identity(),
|
Transform::identity(),
|
||||||
@@ -142,7 +144,7 @@ impl Sirius {
|
|||||||
impl RootHandler for Sirius {
|
impl RootHandler for Sirius {
|
||||||
fn frame(&mut self, info: FrameInfo) {
|
fn frame(&mut self, info: FrameInfo) {
|
||||||
for app in &mut self.clients {
|
for app in &mut self.clients {
|
||||||
app.frame(info);
|
app.frame(&info);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.grabbable.update(&info).unwrap();
|
self.grabbable.update(&info).unwrap();
|
||||||
@@ -179,7 +181,7 @@ impl RootHandler for Sirius {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.model
|
self.model
|
||||||
.model_part("?????")
|
.part("?????")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.set_material_parameter(
|
.set_material_parameter(
|
||||||
"color",
|
"color",
|
||||||
@@ -187,7 +189,7 @@ impl RootHandler for Sirius {
|
|||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
self.model
|
self.model
|
||||||
.model_part("?????")
|
.part("?????")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.set_material_parameter(
|
.set_material_parameter(
|
||||||
"emission_factor",
|
"emission_factor",
|
||||||
@@ -199,7 +201,7 @@ impl RootHandler for Sirius {
|
|||||||
if self.button.released() {
|
if self.button.released() {
|
||||||
println!("Touch ended");
|
println!("Touch ended");
|
||||||
self.model
|
self.model
|
||||||
.model_part("?????")
|
.part("?????")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.set_material_parameter(
|
.set_material_parameter(
|
||||||
"color",
|
"color",
|
||||||
@@ -207,7 +209,7 @@ impl RootHandler for Sirius {
|
|||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
self.model
|
self.model
|
||||||
.model_part("?????")
|
.part("?????")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.set_material_parameter(
|
.set_material_parameter(
|
||||||
"emission_factor",
|
"emission_factor",
|
||||||
@@ -217,17 +219,17 @@ impl RootHandler for Sirius {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn save_state(&mut self) -> ClientState {
|
fn save_state(&mut self) -> Result<ClientState> {
|
||||||
ClientState {
|
ClientState::new(
|
||||||
data: flexbuffers::to_vec(&self.state).unwrap(),
|
Some(self.state.clone()),
|
||||||
root: self.grabbable.content_parent().alias(),
|
self.grabbable.content_parent(),
|
||||||
spatial_anchors: [(
|
[(
|
||||||
"content_parent".to_string(),
|
"content_parent".to_string(),
|
||||||
self.grabbable.content_parent().alias(),
|
self.grabbable.content_parent(),
|
||||||
)]
|
)]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.collect(),
|
.collect(),
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,11 +246,11 @@ fn model_from_icon(parent: &Spatial, icon: &Icon) -> Result<Model> {
|
|||||||
t,
|
t,
|
||||||
&ResourceID::new_namespaced("protostar", "hexagon/hexagon"),
|
&ResourceID::new_namespaced("protostar", "hexagon/hexagon"),
|
||||||
)?;
|
)?;
|
||||||
model.model_part("Hex")?.set_material_parameter(
|
model.part("Hex")?.set_material_parameter(
|
||||||
"color",
|
"color",
|
||||||
MaterialParameter::Color(rgba_linear!(0.0, 1.0, 1.0, 1.0)),
|
MaterialParameter::Color(rgba_linear!(0.0, 1.0, 1.0, 1.0)),
|
||||||
)?;
|
)?;
|
||||||
model.model_part("Icon")?.set_material_parameter(
|
model.part("Icon")?.set_material_parameter(
|
||||||
"diffuse",
|
"diffuse",
|
||||||
MaterialParameter::Texture(ResourceID::Direct(icon.path.clone())),
|
MaterialParameter::Texture(ResourceID::Direct(icon.path.clone())),
|
||||||
)?;
|
)?;
|
||||||
@@ -268,7 +270,7 @@ pub struct App {
|
|||||||
parent: Spatial,
|
parent: Spatial,
|
||||||
position: Vector3<f32>,
|
position: Vector3<f32>,
|
||||||
grabbable: Grabbable,
|
grabbable: Grabbable,
|
||||||
_field: BoxField,
|
_field: Field,
|
||||||
icon: Model,
|
icon: Model,
|
||||||
label: Option<Text>,
|
label: Option<Text>,
|
||||||
grabbable_shrink: Option<Tweener<f32, f64, QuartInOut>>,
|
grabbable_shrink: Option<Tweener<f32, f64, QuartInOut>>,
|
||||||
@@ -283,7 +285,11 @@ impl App {
|
|||||||
desktop_file: DesktopFile,
|
desktop_file: DesktopFile,
|
||||||
) -> Result<Self> {
|
) -> Result<Self> {
|
||||||
let position = position.into();
|
let position = position.into();
|
||||||
let field = BoxField::create(parent, Transform::identity(), [APP_SIZE; 3])?;
|
let field = Field::create(
|
||||||
|
parent,
|
||||||
|
Transform::identity(),
|
||||||
|
Shape::Box([APP_SIZE; 3].into()),
|
||||||
|
)?;
|
||||||
let application = Application::create(desktop_file)?;
|
let application = Application::create(desktop_file)?;
|
||||||
let icon = application.icon(128, false);
|
let icon = application.icon(128, false);
|
||||||
let grabbable = Grabbable::create(
|
let grabbable = Grabbable::create(
|
||||||
@@ -367,12 +373,12 @@ impl App {
|
|||||||
self.currently_shown = !self.currently_shown;
|
self.currently_shown = !self.currently_shown;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn frame(&mut self, info: FrameInfo) {
|
fn frame(&mut self, info: &FrameInfo) {
|
||||||
let _ = self.grabbable.update(&info);
|
let _ = self.grabbable.update(&info);
|
||||||
|
|
||||||
if let Some(grabbable_move) = &mut self.grabbable_move {
|
if let Some(grabbable_move) = &mut self.grabbable_move {
|
||||||
if !grabbable_move.is_finished() {
|
if !grabbable_move.is_finished() {
|
||||||
let scale = grabbable_move.move_by(info.delta);
|
let scale = grabbable_move.move_by(info.delta.into());
|
||||||
self.grabbable
|
self.grabbable
|
||||||
.content_parent()
|
.content_parent()
|
||||||
.set_relative_transform(
|
.set_relative_transform(
|
||||||
@@ -392,7 +398,7 @@ impl App {
|
|||||||
}
|
}
|
||||||
if let Some(grabbable_shrink) = &mut self.grabbable_shrink {
|
if let Some(grabbable_shrink) = &mut self.grabbable_shrink {
|
||||||
if !grabbable_shrink.is_finished() {
|
if !grabbable_shrink.is_finished() {
|
||||||
let scale = grabbable_shrink.move_by(info.delta);
|
let scale = grabbable_shrink.move_by(info.delta.into());
|
||||||
self.grabbable
|
self.grabbable
|
||||||
.content_parent()
|
.content_parent()
|
||||||
.set_relative_transform(&self.parent, Transform::from_scale([scale; 3]))
|
.set_relative_transform(&self.parent, Transform::from_scale([scale; 3]))
|
||||||
@@ -427,7 +433,7 @@ impl App {
|
|||||||
}
|
}
|
||||||
} else if let Some(grabbable_grow) = &mut self.grabbable_grow {
|
} else if let Some(grabbable_grow) = &mut self.grabbable_grow {
|
||||||
if !grabbable_grow.is_finished() {
|
if !grabbable_grow.is_finished() {
|
||||||
let scale = grabbable_grow.move_by(info.delta);
|
let scale = grabbable_grow.move_by(info.delta.into());
|
||||||
self.grabbable
|
self.grabbable
|
||||||
.content_parent()
|
.content_parent()
|
||||||
.set_relative_transform(&self.parent, Transform::from_scale([scale; 3]))
|
.set_relative_transform(&self.parent, Transform::from_scale([scale; 3]))
|
||||||
|
|||||||
Reference in New Issue
Block a user