diff --git a/examples/basic_sprite.rs b/examples/basic_sprite.rs index 1019ce106e7665d1270a2d54961a90d88fef2a26..ee3d6d00411690ac2dd052cb7ebd880362a83c85 100644 --- a/examples/basic_sprite.rs +++ b/examples/basic_sprite.rs @@ -32,7 +32,7 @@ fn setup(mut commands: Commands, windows: Query<&Window, With<PrimaryWindow>>) { }, text_position: CosmicTextPosition::Center, cosmic_attrs: CosmicAttrs(AttrsOwned::new(attrs)), - set_text: CosmicText::OneStyle("😀😀😀 x => y".to_string()), + text: CosmicText::OneStyle("😀😀😀 x => y".to_string()), ..default() }; diff --git a/examples/basic_ui.rs b/examples/basic_ui.rs index 09235a7eb7e3178ff1811ed389aabe7a3e3fb17f..18267ec80d7f403f07971f0c4653c89a86f888a4 100644 --- a/examples/basic_ui.rs +++ b/examples/basic_ui.rs @@ -33,7 +33,7 @@ fn setup(mut commands: Commands, windows: Query<&Window, With<PrimaryWindow>>) { }, text_position: CosmicTextPosition::Center, cosmic_attrs: CosmicAttrs(AttrsOwned::new(attrs)), - set_text: CosmicText::OneStyle("😀😀😀 x => y".to_string()), + text: CosmicText::OneStyle("😀😀😀 x => y".to_string()), ..default() }; diff --git a/examples/every_option.rs b/examples/every_option.rs index 0fe4f19a95fa4f8ac43556ecea21e659ea5744ba..9777aeee3eb2c517cda89813a9156f6b0fb16a2d 100644 --- a/examples/every_option.rs +++ b/examples/every_option.rs @@ -49,7 +49,7 @@ fn setup(mut commands: Commands, windows: Query<&Window, With<PrimaryWindow>>) { }, max_chars: CosmicMaxChars(15), max_lines: CosmicMaxLines(1), - set_text: CosmicText::OneStyle("BANANA IS THE CODEWORD!".into()), + text: CosmicText::OneStyle("BANANA IS THE CODEWORD!".into()), }) .id(); diff --git a/examples/font_per_widget.rs b/examples/font_per_widget.rs index 089a17b2d660da9a84b7c14759a9f8f479a55e91..fa90dadaf44ea6f239761004fe4b5928207c5ba5 100644 --- a/examples/font_per_widget.rs +++ b/examples/font_per_widget.rs @@ -225,7 +225,7 @@ fn setup(mut commands: Commands, windows: Query<&Window, With<PrimaryWindow>>) { ..default() }, background_color: BackgroundColor(Color::WHITE), - set_text: CosmicText::MultiStyle(lines), + text: CosmicText::MultiStyle(lines), ..default() }; @@ -247,7 +247,7 @@ fn setup(mut commands: Commands, windows: Query<&Window, With<PrimaryWindow>>) { height: Val::Percent(100.), ..default() }, - set_text: CosmicText::OneStyle("Widget 2.\nClick on me =>".to_string()), + text: CosmicText::OneStyle("Widget 2.\nClick on me =>".to_string()), ..default() }; diff --git a/examples/multiple_sprites.rs b/examples/multiple_sprites.rs index 2c2c74a26b44487fe11420b750bcb76bda600c24..77e7ad54a5ed896ffb6d69bf912d1773560965e5 100644 --- a/examples/multiple_sprites.rs +++ b/examples/multiple_sprites.rs @@ -37,7 +37,7 @@ fn setup(mut commands: Commands, windows: Query<&Window, With<PrimaryWindow>>) { transform: Transform::from_translation(Vec3::new(-primary_window.width() / 4., 0., 1.)), text_position: CosmicTextPosition::Center, background_color: BackgroundColor(Color::ALICE_BLUE), - set_text: CosmicText::OneStyle("😀😀😀 x => y".to_string()), + text: CosmicText::OneStyle("😀😀😀 x => y".to_string()), ..default() }; @@ -58,7 +58,7 @@ fn setup(mut commands: Commands, windows: Query<&Window, With<PrimaryWindow>>) { )), text_position: CosmicTextPosition::Center, background_color: BackgroundColor(Color::GRAY.with_a(0.5)), - set_text: CosmicText::OneStyle("Widget_2. Click on me".to_string()), + text: CosmicText::OneStyle("Widget_2. Click on me".to_string()), ..default() }; diff --git a/examples/readonly.rs b/examples/readonly.rs index efbacca3cb28bda313836dfb5cd7fb1d7442f344..e42a3b259ee24330cd6cb9d0932fe377e6704a9c 100644 --- a/examples/readonly.rs +++ b/examples/readonly.rs @@ -37,7 +37,7 @@ fn setup(mut commands: Commands, windows: Query<&Window, With<PrimaryWindow>>) { line_height: 18., scale_factor: primary_window.scale_factor() as f32, }, - set_text: CosmicText::OneStyle("😀😀😀 x => y\nRead only widget".to_string()), + text: CosmicText::OneStyle("😀😀😀 x => y\nRead only widget".to_string()), ..default() }; diff --git a/examples/restricted_input.rs b/examples/restricted_input.rs index e43b2aa5860f8976dd7fa96445450e04da99f420..7077e37ae35c693410823056ad8241271bbfffbe 100644 --- a/examples/restricted_input.rs +++ b/examples/restricted_input.rs @@ -32,7 +32,7 @@ fn setup(mut commands: Commands, windows: Query<&Window, With<PrimaryWindow>>) { }, max_chars: CosmicMaxChars(15), max_lines: CosmicMaxLines(1), - set_text: CosmicText::OneStyle( + text: CosmicText::OneStyle( "1 line 15 chars! But this\n is longer\n than is\n allowed by\n the limits.\n" .into(), ), diff --git a/src/lib.rs b/src/lib.rs index 0a669d39944ac1685f7cc6a8a5870aba43edecfc..b970fee16507cc26b00399b7ab5288fb4abe79d7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -284,8 +284,7 @@ pub struct CosmicEditUiBundle { /// How many characters are allowed in buffer, 0 for no limit pub max_chars: CosmicMaxChars, /// Setting this will update the buffer's text - // TODO sync this with the buffer to allow getting from here as well as setting - pub set_text: CosmicText, + pub text: CosmicText, } impl Default for CosmicEditUiBundle { @@ -310,7 +309,7 @@ impl Default for CosmicEditUiBundle { background_image: Default::default(), max_lines: Default::default(), max_chars: Default::default(), - set_text: Default::default(), + text: Default::default(), } } } @@ -341,7 +340,8 @@ pub struct CosmicEditSpriteBundle { pub max_lines: CosmicMaxLines, /// How many characters are allowed in buffer, 0 for no limit pub max_chars: CosmicMaxChars, - pub set_text: CosmicText, + /// Setting this will update the buffer's text + pub text: CosmicText, } impl Default for CosmicEditSpriteBundle { @@ -360,7 +360,7 @@ impl Default for CosmicEditSpriteBundle { background_image: Default::default(), max_lines: Default::default(), max_chars: Default::default(), - set_text: Default::default(), + text: Default::default(), } } } @@ -1482,7 +1482,7 @@ mod tests { fn test_spawn_cosmic_edit_system(mut commands: Commands) { commands.spawn(CosmicEditUiBundle { - set_text: CosmicText::OneStyle("Blah".into()), + text: CosmicText::OneStyle("Blah".into()), ..Default::default() }); }