Pin the hover-then-scroll case, and say what the line means
A wheel makes `position_only` false, so a button already hovered in a layer above does not consume it -- but the line read as though it might. `hovering_a_button_above_does_not_stop_a_later_scroll` is that case in the two frames a window actually delivers it in, and the comment now leads with it. `resting` is renamed to `position_only`, so the same word is used throughout.
This commit is contained in:
1 parent
827d317f41
commit
8cac927438
2 files changed
+32
-7
No files matched your search
@@ -182,7 +182,7 @@ impl SensorUi for UiRenderState {
|
||||
// state like thing, but local to render state, and is passed to UiRsc events so you can
|
||||
// update it there?
|
||||
let mut active = std::mem::take(&mut rsc.events_mut().get_type::<CursorSense>().active);
|
||||
let resting = cursor.position_only();
|
||||
let position_only = cursor.position_only();
|
||||
for layer in self.layers.indices().rev() {
|
||||
let mut consumed = false;
|
||||
for (id, sensor) in active.get_mut(&layer).into_flat_iter() {
|
||||
@@ -206,13 +206,13 @@ impl SensorUi for UiRenderState {
|
||||
sense: CursorSense::Hovering,
|
||||
render: self,
|
||||
};
|
||||
// A cursor that is only resting stops at the layer it is
|
||||
// over, answered or not -- but not at a widget it has just
|
||||
// left, which is here only to end its hover. An action stops
|
||||
// where something answered it, so a button over a list does
|
||||
// not swallow the list's scrolling.
|
||||
// A press or a scroll stops where something answered it, so a
|
||||
// button over a list does not swallow the list's scrolling. A
|
||||
// cursor doing neither stops at the widget it is over, so
|
||||
// hovering does not reach through one -- but not at a widget
|
||||
// it has just left, which is here only to end its hover.
|
||||
let answered = rsc.run_event::<CursorSense>(*id, data, state);
|
||||
consumed |= answered || (resting && in_shape);
|
||||
consumed |= answered || (position_only && in_shape);
|
||||
}
|
||||
if consumed {
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user