Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to disable mouse dragging on scroll area. #2163

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

alphaqu
Copy link

@alphaqu alphaqu commented Oct 18, 2022

Adds an option in scrollarea to disable dragging with the mouse seperatley from the option to disable scrolling entirely.
There is not much more to this commit and i am unsure if it is a trivial change.

Copy link
Owner

@emilk emilk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

crates/egui/src/containers/scroll_area.rs Outdated Show resolved Hide resolved
crates/epaint/src/text/text_layout.rs Outdated Show resolved Hide resolved
crates/egui/src/containers/scroll_area.rs Outdated Show resolved Hide resolved
@@ -608,7 +629,7 @@ impl Prepared {

if content_is_too_large[0] || content_is_too_large[1] {
// Drag contents to scroll (for touch screens mostly):
let sense = if self.scrolling_enabled {
let sense = if self.drag_to_scroll_enabled {
Copy link
Contributor

@mkrueger mkrueger Dec 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it check both flags ?
let sense = if self.scrolling_enabled && self.drag_to_scroll_enabled {

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it should

@mkrueger
Copy link
Contributor

mkrueger commented Dec 5, 2022

I can really, really need that. Thanks.

@@ -90,6 +90,8 @@ pub struct ScrollArea {
offset_y: Option<f32>,
/// If false, we ignore scroll events.
scrolling_enabled: bool,
/// If false we ignore mouse drag events.
drag_to_scroll_enabled: bool,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When would you want to turn this off for just one ScrollArea an not another?
Wouldn't it make more sense to put this as global setting in Style instead?

@@ -521,6 +541,7 @@ impl Prepared {
content_ui,
viewport: _,
scrolling_enabled,
drag_to_scroll_enabled: mouse_dragging_enabled,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
drag_to_scroll_enabled: mouse_dragging_enabled,
drag_to_scroll_enabled,

Copy link
Owner

@emilk emilk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try out the cursor in any other application and try to follow that behavior.

  1. While typing, there shouldn't be blinking
  2. When stopping to type, there should be a short delay before the blinking starts
  3. The on-period and off-period should be equally long

A badly implemented cursor blinking is more annoying than useful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants