Skip to content

Commit 32048e6

Browse files
committed
check
1 parent e9c8570 commit 32048e6

18 files changed

+109
-114
lines changed

Cargo.lock

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ bevy_window = { version = "0.17", default-features = false }
4040
bevy_winit = { version = "0.17", default-features = false, features = ["x11"] }
4141
bevy_ui_text_input = { version = "0.6", default-features = false, optional = true }
4242
bevy-async-ecs = { version = "0.9", optional = true }
43-
jonmo = "0.5"
43+
# jonmo = "0.5"
44+
jonmo = { git = "https://github.com/databasedav/jonmo", branch = "more_haalka_bevy_0.17" }
4445
cosmic-text = "0.14.2"
4546
apply = "0.3"
4647
cfg-if = "1.0"

examples/calculator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct Error;
3939
#[derive(Resource, Clone, Deref, DerefMut)]
4040
struct Output(String);
4141

42-
fn textable_element(text_signal: impl Signal<Item = impl Into<String> + 'static> + Send + 'static) -> El<Node> {
42+
fn textable_element(text_signal: impl Signal<Item = impl Into<String> + 'static> + 'static) -> El<Node> {
4343
El::<Node>::new()
4444
.with_node(|mut node| node.border = UiRect::all(Val::Px(2.0)))
4545
.border_color(BorderColor::all(Color::WHITE))

examples/dot_counter.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ fn labeled_element(label: impl Element, element: impl Element) -> impl Element {
119119
.item(element.align(Align::new().center_y()))
120120
}
121121

122-
fn labeled_count(label: impl Element, count_signal: impl Signal<Item = i32> + Send + 'static) -> impl Element {
122+
fn labeled_count(label: impl Element, count_signal: impl Signal<Item = i32> + 'static) -> impl Element {
123123
labeled_element(label, {
124124
El::<Text>::new()
125125
.text_font(TextFont::from_font_size(FONT_SIZE))
@@ -142,11 +142,7 @@ fn text_labeled_element(label: &str, element: impl Element) -> impl Element {
142142
)
143143
}
144144

145-
fn text_labeled_count(
146-
label: &str,
147-
font_size: f32,
148-
count_signal: impl Signal<Item = i32> + Send + 'static,
149-
) -> impl Element {
145+
fn text_labeled_count(label: &str, font_size: f32, count_signal: impl Signal<Item = i32> + 'static) -> impl Element {
150146
labeled_element(
151147
El::<Text>::new()
152148
.text_font(TextFont::from_font_size(font_size))
@@ -163,7 +159,7 @@ fn text_labeled_count(
163159
)
164160
}
165161

166-
fn category_count(category: ColorCategory, count: impl Signal<Item = i32> + Send + 'static) -> impl Element {
162+
fn category_count(category: ColorCategory, count: impl Signal<Item = i32> + 'static) -> impl Element {
167163
labeled_count(
168164
{
169165
El::<Node>::new()
@@ -224,7 +220,7 @@ where
224220
)
225221
}
226222

227-
fn rate_element<T: Component, R>(rate_signal: impl Signal<Item = f32> + Send + 'static) -> impl Element
223+
fn rate_element<T: Component, R>(rate_signal: impl Signal<Item = f32> + 'static) -> impl Element
228224
where
229225
R: Resource + Clone + Copy + Deref<Target = f32> + DerefMut,
230226
{

examples/dragging.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@ fn square(i: usize) -> impl Element {
141141
)
142142
.on_dragged(
143143
|In((entity, drag_data)): In<(Entity, DragData)>, mut nodes: Query<(&mut Node, &DragOffset)>| {
144-
if drag_data.dragged {
145-
if let Ok((node, drag_offset)) = nodes.get_mut(entity) {
146-
set_dragging_position(node, drag_data.pointer_location.position, drag_offset.0);
147-
}
144+
if drag_data.dragged
145+
&& let Ok((node, drag_offset)) = nodes.get_mut(entity)
146+
{
147+
set_dragging_position(node, drag_data.pointer_location.position, drag_offset.0);
148148
}
149149
},
150150
)

examples/futures_signals_jonmo_compat.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use bevy::{prelude::*, ui::Pressed};
99
use haalka::{
1010
futures_signals::prelude::*,
1111
prelude::{
12-
Align as jAlign, Alignable as _, BuilderPassThrough, BuilderWrapper, Draggable, El as jEl,
13-
Element as jElement, Hoverable, Hovered, LazyEntity, Pressable, SignalExt as _, signal,
12+
Align as jAlign, Alignable as _, BuilderPassThrough, BuilderWrapper, Draggable, El as jEl, Element as jElement,
13+
Hoverable, Hovered, LazyEntity, Pressable, SignalExt as _, signal,
1414
},
1515
};
1616

examples/healthbar.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ fn sync_tracking_healthbar_position(
143143
// ui_scale.0 = starting_distance as f64 / scale as f64;
144144
}
145145

146-
fn health_signal() -> impl Signal<Item = u32> + Clone + Send + Sync + 'static {
146+
fn health_signal() -> impl Signal<Item = u32> + Clone + 'static {
147147
signal::from_system(|In(_), health: Option<Single<&Health>>| health.map(deref_copied).map(|health| health.0))
148148
.dedupe()
149149
}

examples/inventory.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ struct RpgIconSheet {
198198
}
199199

200200
fn icon(
201-
index_signal: impl Signal<Item = usize> + Send + 'static,
202-
count_signal: impl Signal<Item = usize> + Send + 'static,
201+
index_signal: impl Signal<Item = usize> + 'static,
202+
count_signal: impl Signal<Item = usize> + 'static,
203203
) -> Stack<Node> {
204204
Stack::new()
205205
.layer(
@@ -546,10 +546,10 @@ fn random_cell(probability: f64, insertable: bool) -> impl Element {
546546
move |In(entity): In<Entity>,
547547
mut rng: Single<&mut WyRand, With<GlobalRng>>,
548548
mut contents: Query<&mut CellContent>| {
549-
if rng.random_bool(probability) {
550-
if let Ok(mut content) = contents.get_mut(entity) {
551-
content.0 = Some(random_cell_data(rng.as_mut()));
552-
}
549+
if rng.random_bool(probability)
550+
&& let Ok(mut content) = contents.get_mut(entity)
551+
{
552+
content.0 = Some(random_cell_data(rng.as_mut()));
553553
}
554554
},
555555
)

examples/key_values_sorted.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,16 +351,15 @@ fn sort_button(sort_by: KeyValue) -> impl Element {
351351
});
352352

353353
// Move each entity to its correct position
354-
for target in 0..sorted.len() {
355-
let target_entity = sorted[target];
354+
for (target, entity) in sorted.into_iter().enumerate() {
356355
// Find where this entity currently is
357-
let current = guard.iter().position(|&e| e == target_entity).unwrap();
356+
let current = guard.iter().position(|&e| e == entity).unwrap();
358357
if current != target {
359358
guard.move_item(current, target);
360359
}
361360
}
362361
},
363-
selected.clone(),
362+
selected,
364363
)
365364
.child(
366365
El::<Text>::new()

examples/main_menu.rs

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use utils::*;
1111

1212
use bevy::{prelude::*, ui::Pressed};
1313
use haalka::{impl_haalka_methods, prelude::*};
14-
use std::{fmt::Display, i32};
14+
use std::fmt::Display;
1515
use strum::{Display as StrumDisplay, EnumIter, IntoEnumIterator};
1616

1717
fn main() {
@@ -50,7 +50,7 @@ fn main() {
5050
resolution: Resolution::R1920x1080,
5151
texture_quality: Quality::Medium,
5252
shadow_quality: Quality::Medium,
53-
anti_aliasing: Some(AntiAliasing::TAA),
53+
anti_aliasing: Some(AntiAliasing::Taa),
5454
})
5555
.run();
5656
}
@@ -392,10 +392,10 @@ enum Resolution {
392392

393393
#[derive(Clone, Copy, PartialEq, StrumDisplay, EnumIter, Default)]
394394
enum AntiAliasing {
395-
FXAA,
395+
Fxaa,
396396
#[default]
397-
TAA,
398-
SMAA,
397+
Taa,
398+
Smaa,
399399
}
400400

401401
/// Component to mark a button as selected (for external control)
@@ -508,20 +508,20 @@ impl Button {
508508
self
509509
}
510510

511-
fn selected_signal(mut self, selected: impl Signal<Item = bool> + Clone + Send + 'static) -> Self {
511+
fn selected_signal(mut self, selected: impl Signal<Item = bool> + Clone + 'static) -> Self {
512512
self.el = self
513513
.el
514514
.component_signal(selected.map_true_in(|| Selected).schedule::<Update>());
515515
self
516516
}
517517

518-
fn hovered_signal(mut self, hovered: impl Signal<Item = bool> + Clone + Send + 'static) -> Self {
518+
fn hovered_signal(mut self, hovered: impl Signal<Item = bool> + Clone + 'static) -> Self {
519519
self.el = self.el.component_signal(hovered.map_true_in(|| VirtualHovered));
520520
self
521521
}
522522
}
523523

524-
fn text_button(text_signal: impl Signal<Item = String> + Clone + Send + 'static) -> Button {
524+
fn text_button(text_signal: impl Signal<Item = String> + Clone + 'static) -> Button {
525525
Button::new()
526526
.body(
527527
El::<Text>::new()
@@ -644,7 +644,7 @@ impl Checkbox {
644644
}
645645
}
646646

647-
fn checked_signal(mut self, signal: impl Signal<Item = bool> + Clone + Send + 'static) -> Self {
647+
fn checked_signal(mut self, signal: impl Signal<Item = bool> + Clone + 'static) -> Self {
648648
let task = signal
649649
.map(
650650
clone!((self.lazy_entity => lazy_entity) move |In(checked), checkeds: Query<&Checked>, mut commands: Commands| {
@@ -665,8 +665,9 @@ impl Checkbox {
665665
fn on_change<M>(mut self, handler: impl IntoSystem<In<bool>, (), M> + Send + Sync + 'static) -> Self {
666666
let task = signal::from_entity(self.lazy_entity.clone())
667667
.has_component::<Checked>()
668-
.skip(1) // otherwise, view will thrash between external value signal and widget-internal default, prioritizes
668+
// otherwise, view will thrash between external value signal and widget-internal default, prioritizes
669669
// external sync
670+
.skip(1)
670671
.dedupe()
671672
.map(handler)
672673
.task();
@@ -800,7 +801,7 @@ impl<T: Display + Clone + PartialEq + Send + Sync + 'static> RadioGroup<T> {
800801
}
801802
}
802803

803-
fn selection_signal(mut self, signal: impl Signal<Item = Option<T>> + Clone + Send + 'static) -> Self {
804+
fn selection_signal(mut self, signal: impl Signal<Item = Option<T>> + Clone + 'static) -> Self {
804805
let task = signal
805806
.map(
806807
clone!((self.lazy_entity => lazy_entity, self.options => options) move |In(selection_option): In<Option<T>>,
@@ -821,8 +822,9 @@ impl<T: Display + Clone + PartialEq + Send + Sync + 'static> RadioGroup<T> {
821822
let task = signal::from_component_changed::<RadioSelection>(self.lazy_entity.clone())
822823
.map_in(deref_copied)
823824
.map_in(clone!((self.options => options) move |i: Option<usize>| i.and_then(|i| options.get(i).cloned())))
824-
.skip(1) // otherwise, view will thrash between external value signal and widget-internal default, prioritizes
825+
// otherwise, view will thrash between external value signal and widget-internal default, prioritizes
825826
// external sync
827+
.skip(1)
826828
.dedupe()
827829
.map(handler)
828830
.task();
@@ -1011,17 +1013,16 @@ impl<T: Display + Clone + PartialEq + Send + Sync + 'static> Spinner<T> {
10111013
self
10121014
}
10131015

1014-
fn selection_signal(mut self, signal: impl Signal<Item = T> + Clone + Send + 'static) -> Self {
1016+
fn selection_signal(mut self, signal: impl Signal<Item = T> + Clone + 'static) -> Self {
10151017
let task = signal
10161018
.map(
10171019
clone!((self.lazy_entity => lazy_entity, self.options => options) move |In(selection): In<T>,
10181020
mut spinners: Query<&mut SpinnerSelection>| {
10191021
let mut selected = spinners.get_mut(*lazy_entity).unwrap();
1020-
if let Some(i) = options.iter().position(|option| *option == selection) {
1021-
if selected.0 != i {
1022+
if let Some(i) = options.iter().position(|option| *option == selection)
1023+
&& selected.0 != i {
10221024
selected.0 = i;
10231025
}
1024-
}
10251026
}),
10261027
)
10271028
.task();
@@ -1032,8 +1033,9 @@ impl<T: Display + Clone + PartialEq + Send + Sync + 'static> Spinner<T> {
10321033
fn on_change<M>(mut self, handler: impl IntoSystem<In<T>, (), M> + Send + Sync + 'static) -> Self {
10331034
let task = signal::from_component_changed::<SpinnerSelection>(self.lazy_entity.clone())
10341035
.map_in(deref_copied)
1035-
.skip(1) // otherwise, view will thrash between external value signal and widget-internal default, prioritizes
1036+
// otherwise, view will thrash between external value signal and widget-internal default, prioritizes
10361037
// external sync
1038+
.skip(1)
10371039
.dedupe()
10381040
.map_in(clone!((self.options => options) move |i: usize| options.get(i).cloned().unwrap()))
10391041
.map(handler)
@@ -1077,8 +1079,7 @@ impl<T: Display + Clone + PartialEq + Send + Sync + 'static> ElementWrapper for
10771079
}))
10781080
.observe(spinner_input_observer)
10791081
.with_node(|mut node| node.column_gap = Val::Px(BASE_PADDING * 2.))
1080-
.item({
1081-
let num_options = num_options;
1082+
.item(
10821083
lil_button()
10831084
.apply(register_as_spinner_button(LeftRight::Left))
10841085
.on_click(
@@ -1089,8 +1090,8 @@ impl<T: Display + Clone + PartialEq + Send + Sync + 'static> ElementWrapper for
10891090
}
10901091
}),
10911092
)
1092-
.body(arrow_text(LeftRight::Left))
1093-
})
1093+
.body(arrow_text(LeftRight::Left)),
1094+
)
10941095
.item({
10951096
let options = options.clone();
10961097
let mut text_el = El::<Text>::new()
@@ -1109,8 +1110,7 @@ impl<T: Display + Clone + PartialEq + Send + Sync + 'static> ElementWrapper for
11091110
}
11101111
text_el
11111112
})
1112-
.item({
1113-
let num_options = num_options;
1113+
.item(
11141114
lil_button()
11151115
.apply(register_as_spinner_button(LeftRight::Right))
11161116
.on_click(
@@ -1121,8 +1121,8 @@ impl<T: Display + Clone + PartialEq + Send + Sync + 'static> ElementWrapper for
11211121
}
11221122
}),
11231123
)
1124-
.body(arrow_text(LeftRight::Right))
1125-
})
1124+
.body(arrow_text(LeftRight::Right)),
1125+
)
11261126
}
11271127
}
11281128

@@ -1160,7 +1160,7 @@ impl Slider {
11601160
}
11611161
}
11621162

1163-
fn value_signal(mut self, signal: impl Signal<Item = f32> + Clone + Send + 'static) -> Self {
1163+
fn value_signal(mut self, signal: impl Signal<Item = f32> + Clone + 'static) -> Self {
11641164
let task = signal
11651165
.map(clone!((self.lazy_entity => lazy_entity) move |In(value): In<f32>,
11661166
mut sliders: Query<&mut SliderValue>,
@@ -1187,8 +1187,9 @@ impl Slider {
11871187
fn on_change<M>(mut self, handler: impl IntoSystem<In<f32>, (), M> + Send + Sync + 'static) -> Self {
11881188
let task = signal::from_component_changed::<SliderValue>(self.lazy_entity.clone())
11891189
.map_in(|slider| slider.value)
1190-
.skip(1) // otherwise, view will thrash between external value signal and widget-internal default, prioritizes
1190+
// otherwise, view will thrash between external value signal and widget-internal default, prioritizes
11911191
// external sync
1192+
.skip(1)
11921193
.dedupe()
11931194
.map(handler)
11941195
.task();
@@ -1430,8 +1431,7 @@ impl<T: Display + Clone + PartialEq + Send + Sync + 'static> Dropdown<T> {
14301431
self
14311432
}
14321433

1433-
/// Sync the selection from an external signal
1434-
fn selection_signal(mut self, signal: impl Signal<Item = Option<T>> + Clone + Send + 'static) -> Self {
1434+
fn selection_signal(mut self, signal: impl Signal<Item = Option<T>> + Clone + 'static) -> Self {
14351435
let task = signal
14361436
.map(
14371437
clone!((self.lazy_entity => lazy_entity, self.options => options) move |In(selection_option): In<Option<T>>,
@@ -1448,7 +1448,6 @@ impl<T: Display + Clone + PartialEq + Send + Sync + 'static> Dropdown<T> {
14481448
self
14491449
}
14501450

1451-
/// Called when the selection changes
14521451
fn on_change<M>(mut self, handler: impl IntoSystem<In<Option<T>>, (), M> + Send + Sync + 'static) -> Self {
14531452
let task = signal::from_component_changed::<DropdownSelectionIndex>(self.lazy_entity.clone())
14541453
.map_in(deref_copied)

0 commit comments

Comments
 (0)