From d91f4f6aa74d0693179a02167d626efa3ac4c20b Mon Sep 17 00:00:00 2001 From: Bingus Date: Sat, 19 Nov 2022 10:29:37 -0800 Subject: Add multidirectional scrolling capabilities to the existing Scrollable. --- examples/websocket/src/main.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'examples/websocket/src') diff --git a/examples/websocket/src/main.rs b/examples/websocket/src/main.rs index ff2929da..b10ef17e 100644 --- a/examples/websocket/src/main.rs +++ b/examples/websocket/src/main.rs @@ -1,10 +1,10 @@ mod echo; use iced::alignment::{self, Alignment}; -use iced::executor; use iced::widget::{ button, column, container, row, scrollable, text, text_input, Column, }; +use iced::{executor, Vector}; use iced::{ Application, Color, Command, Element, Length, Settings, Subscription, Theme, }; @@ -81,7 +81,10 @@ impl Application for WebSocket { echo::Event::MessageReceived(message) => { self.messages.push(message); - scrollable::snap_to(MESSAGE_LOG.clone(), 1.0) + scrollable::snap_to( + MESSAGE_LOG.clone(), + Vector::new(0.0, 1.0), + ) } }, Message::Server => Command::none(), -- cgit From 9f85e0c721927f1e3bd195a998ec7a80ec0e7455 Mon Sep 17 00:00:00 2001 From: bungoboingo Date: Sat, 24 Dec 2022 21:27:44 -0800 Subject: Reworked Scrollable to account for lack of widget order guarantees. Fixed thumb "snapping" bug on scrollable when cursor is out of bounds. --- examples/websocket/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'examples/websocket/src') diff --git a/examples/websocket/src/main.rs b/examples/websocket/src/main.rs index b10ef17e..d1e45571 100644 --- a/examples/websocket/src/main.rs +++ b/examples/websocket/src/main.rs @@ -4,7 +4,7 @@ use iced::alignment::{self, Alignment}; use iced::widget::{ button, column, container, row, scrollable, text, text_input, Column, }; -use iced::{executor, Vector}; +use iced::{executor, Point}; use iced::{ Application, Color, Command, Element, Length, Settings, Subscription, Theme, }; @@ -83,7 +83,7 @@ impl Application for WebSocket { scrollable::snap_to( MESSAGE_LOG.clone(), - Vector::new(0.0, 1.0), + Point::new(0.0, 1.0), ) } }, -- cgit From 624a4ada7981eb05c0b50cafa7e9545ad8347cb5 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 8 Jan 2023 20:07:11 +0100 Subject: Introduce `RelativeOffset` type in `scrollable` --- examples/websocket/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'examples/websocket/src') diff --git a/examples/websocket/src/main.rs b/examples/websocket/src/main.rs index d1e45571..ccd9c815 100644 --- a/examples/websocket/src/main.rs +++ b/examples/websocket/src/main.rs @@ -1,10 +1,10 @@ mod echo; use iced::alignment::{self, Alignment}; +use iced::executor; use iced::widget::{ button, column, container, row, scrollable, text, text_input, Column, }; -use iced::{executor, Point}; use iced::{ Application, Color, Command, Element, Length, Settings, Subscription, Theme, }; @@ -83,7 +83,7 @@ impl Application for WebSocket { scrollable::snap_to( MESSAGE_LOG.clone(), - Point::new(0.0, 1.0), + scrollable::RelativeOffset::END, ) } }, -- cgit