Skip to content

Change force to be Option<f32> instead of f32 - #3240

Merged
emilk merged 1 commit into
emilk:masterfrom
lucasmerlin:force_option_f32
Aug 12, 2023
Merged

emilk merged 1 commit into
emilk:masterfrom
lucasmerlin:force_option_f32

Conversation

@lucasmerlin

Copy link
Copy Markdown
Collaborator

Force being 0 having two meanings makes it hard to tell whether it has just been a very light touch or whether no force is provided.

In my drawing app I draw a thick line when pressure is close to 1 or the device has no pressure and a thin line when pressure is close to 0.

Not being able to tell between 0 and None causes bugs where faint strokes suddenly have thick blobs when pressure reaches 0. This could be avoided with some clever logic but the changes in this PR make it a lot easier.

There also is a force variable in MultiTouchInfo but I don't think that one needs to be changed to Option since it's an average. But I could also update it for consitency.

@emilk emilk added eframe Relates to epi and eframe egui labels Aug 11, 2023
@emilk
emilk merged commit 1036cb1 into emilk:master Aug 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

eframe Relates to epi and eframe egui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants