0.4
This commit is contained in:
parent
570d00d99a
commit
17d4cfb263
|
|
@ -1,5 +1,11 @@
|
|||
# CHANGELOG
|
||||
|
||||
## [0.4.0]
|
||||
|
||||
## Changed
|
||||
|
||||
- Updated to Bevy 0.16
|
||||
|
||||
## [0.3.2]
|
||||
|
||||
## Added
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "bevy_simple_scroll_view"
|
||||
version = "0.3.2"
|
||||
version = "0.4.0"
|
||||
edition = "2021"
|
||||
exclude = [".github/", "wasm/", "record.gif"]
|
||||
categories = ["game-development", "gui"]
|
||||
|
|
@ -11,17 +11,17 @@ license = "MIT OR Apache-2.0"
|
|||
description = "Simple to use plugin implementing ScrollView into Bevy engine."
|
||||
|
||||
[dependencies.bevy]
|
||||
version = "0.15"
|
||||
version = "0.16"
|
||||
default-features = false
|
||||
features = ["bevy_ui", "bevy_asset", "bevy_text"]
|
||||
|
||||
[dev-dependencies.bevy]
|
||||
version = "0.15"
|
||||
version = "0.16"
|
||||
default-features = true
|
||||
|
||||
[features]
|
||||
default = []
|
||||
extra_logs = []
|
||||
extra_logs = ["bevy/bevy_log"]
|
||||
|
||||
[lints.rust]
|
||||
missing_docs = "warn"
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ Please keep PRs small and scoped to a single feature or fix.
|
|||
|
||||
Bevy version | crate version
|
||||
--- | ---
|
||||
0.16 | 0.4
|
||||
0.15 | 0.3
|
||||
0.14 | 0.2
|
||||
0.13 | 0.1
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#![allow(missing_docs)]
|
||||
|
||||
use bevy::picking::events::{Pointer, Up};
|
||||
use bevy::picking::events::{Pointer, Released};
|
||||
use bevy::prelude::*;
|
||||
use bevy_simple_scroll_view::*;
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ fn setup(mut commands: Commands) {
|
|||
justify_content: JustifyContent::Center,
|
||||
min_width: Val::Px(200.0),
|
||||
margin: UiRect::all(Val::Px(10.0)),
|
||||
border: UiRect::all(Val::Px(3.0)),
|
||||
border: UiRect::all(Val::Px(5.0)),
|
||||
padding: UiRect::all(Val::Px(15.0)),
|
||||
..default()
|
||||
};
|
||||
|
|
@ -75,10 +75,10 @@ fn setup(mut commands: Commands) {
|
|||
});
|
||||
}
|
||||
|
||||
fn scroll_to_top(_t: Trigger<Pointer<Up>>, mut scroll: Single<&mut ScrollableContent>) {
|
||||
fn scroll_to_top(_t: Trigger<Pointer<Released>>, mut scroll: Single<&mut ScrollableContent>) {
|
||||
scroll.scroll_to_top();
|
||||
}
|
||||
|
||||
fn scroll_to_bottom(_t: Trigger<Pointer<Up>>, mut scroll: Single<&mut ScrollableContent>) {
|
||||
fn scroll_to_bottom(_t: Trigger<Pointer<Released>>, mut scroll: Single<&mut ScrollableContent>) {
|
||||
scroll.scroll_to_bottom();
|
||||
}
|
||||
|
|
|
|||
12
src/lib.rs
12
src/lib.rs
|
|
@ -39,7 +39,7 @@ impl Plugin for ScrollViewPlugin {
|
|||
|
||||
/// Root component of scroll, it should have clipped style.
|
||||
#[derive(Component, Debug, Reflect)]
|
||||
#[require(Interaction, Node(scroll_view_node))]
|
||||
#[require(Interaction, Node = scroll_view_node())]
|
||||
pub struct ScrollView {
|
||||
/// Field which control speed of the scrolling.
|
||||
/// Could be negative number to implement invert scroll
|
||||
|
|
@ -57,7 +57,7 @@ impl Default for ScrollView {
|
|||
/// Component containing offset value of the scroll container to the parent.
|
||||
/// It is possible to update the field `pos_y` manually to move scrollview to desired location.
|
||||
#[derive(Component, Debug, Reflect, Default)]
|
||||
#[require(Node(scroll_content_node))]
|
||||
#[require(Node = scroll_content_node())]
|
||||
pub struct ScrollableContent {
|
||||
/// Scroll container offset to the `ScrollView`.
|
||||
pub pos_y: f32,
|
||||
|
|
@ -140,7 +140,7 @@ fn input_mouse_pressed_move(
|
|||
if interaction != Interaction::Pressed {
|
||||
continue;
|
||||
}
|
||||
for &child in children.iter() {
|
||||
for child in children.iter() {
|
||||
let Ok(mut scroll) = content_q.get_mut(child) else {
|
||||
continue;
|
||||
};
|
||||
|
|
@ -156,7 +156,7 @@ fn update_size(
|
|||
) {
|
||||
for (children, scroll_view_node) in q.iter_mut() {
|
||||
let container_height = scroll_view_node.size().y * scroll_view_node.inverse_scale_factor();
|
||||
for &child in children.iter() {
|
||||
for child in children.iter() {
|
||||
let Ok((mut scroll, node)) = content_q.get_mut(child) else {
|
||||
continue;
|
||||
};
|
||||
|
|
@ -186,7 +186,7 @@ fn input_touch_pressed_move(
|
|||
if interaction != Interaction::Pressed {
|
||||
continue;
|
||||
}
|
||||
for &child in children.iter() {
|
||||
for child in children.iter() {
|
||||
let Ok(mut scroll) = content_q.get_mut(child) else {
|
||||
continue;
|
||||
};
|
||||
|
|
@ -217,7 +217,7 @@ fn scroll_events(
|
|||
#[cfg(feature = "extra_logs")]
|
||||
info!("Scroolling by {:#?}: {} movement", ev.unit, y);
|
||||
|
||||
for &child in children.iter() {
|
||||
for child in children.iter() {
|
||||
let Ok(mut scroll) = content_q.get_mut(child) else {
|
||||
continue;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue