diff --git a/Cargo.lock b/Cargo.lock index 61fd581a803ad968ffac6c85ae31cb716a70d7a4..2ebc893bd8213bddf763c326f201100cac6e73ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -388,7 +388,7 @@ dependencies = [ [[package]] name = "bevy_cosmic_edit" -version = "0.10.1" +version = "0.11.0" dependencies = [ "arboard", "bevy", diff --git a/Cargo.toml b/Cargo.toml index f9e4a83654cd2f70b2a6c255fec292c644c4e6ab..6894731a7df86c8992cced398f2b1b1db0fc0494 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_cosmic_edit" -version = "0.10.1" +version = "0.11.0" edition = "2021" license = "MIT OR Apache-2.0" description = "Bevy cosmic-text multiline text input" diff --git a/examples/restricted_input.rs b/examples/restricted_input.rs index c43c67814d312cbdc52df9aaa13ae89f12fd054f..01a130114d7e921faf609b1b750b95b5d4117371 100644 --- a/examples/restricted_input.rs +++ b/examples/restricted_input.rs @@ -1,4 +1,4 @@ -use bevy::prelude::*; +use bevy::{prelude::*, window::PrimaryWindow}; use bevy_cosmic_edit::{ change_active_editor_sprite, change_active_editor_ui, ActiveEditor, CosmicAttrs, CosmicEditPlugin, CosmicEditUiBundle, CosmicFontSystem, CosmicMaxChars, CosmicMaxLines, @@ -6,10 +6,15 @@ use bevy_cosmic_edit::{ }; use cosmic_text::{Attrs, AttrsOwned}; -fn setup(mut commands: Commands, mut font_system: ResMut<CosmicFontSystem>) { +fn setup( + mut commands: Commands, + mut font_system: ResMut<CosmicFontSystem>, + windows: Query<&Window, With<PrimaryWindow>>, +) { commands.spawn(Camera2dBundle::default()); let attrs = AttrsOwned::new(Attrs::new().color(cosmic_text::Color::rgb(69, 69, 69))); + let primary_window = windows.single(); let editor = commands .spawn( @@ -28,7 +33,7 @@ fn setup(mut commands: Commands, mut font_system: ResMut<CosmicFontSystem>) { cosmic_metrics: CosmicMetrics { font_size: 16., line_height: 16., - ..Default::default() + scale_factor: primary_window.scale_factor() as f32, }, max_chars: CosmicMaxChars(15), max_lines: CosmicMaxLines(1),