Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@jason-simmons
Copy link
Member

No description provided.

boolean isPointerEvent = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2
&& event.isFromSource(InputDevice.SOURCE_CLASS_POINTER);
if (!isPointerEvent || event.getActionMasked() != MotionEvent.ACTION_HOVER_MOVE) {
if (!(isPointerEvent &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we pull this conditional into another boolean variable? I'm not clear on what this condition signifies. I'm wondering what it means if its not a pointer event but it is a hover move. I'm also wondering what it affirmatively means to be a pointer + hover move, or a pointer + scroll.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

int pointerKind = getPointerDeviceTypeForToolType(event.getToolType(pointerIndex));

int signalKind = PointerSignalKind.NONE;
int signalKind = event.getActionMasked() == MotionEvent.ACTION_SCROLL ?
Copy link
Contributor

Choose a reason for hiding this comment

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

Stylistically, can we either keep this on one line, or otherwise break at the "?" and ":"

int signalKind = event.getActionMasked() == MotionEvent.ACTION_SCROLL
  ? PointerSignalKind.SCROLL
  : PointerSignalKind.NONE;

Copy link
Member Author

Choose a reason for hiding this comment

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

done

if (maskedAction == MotionEvent.ACTION_CANCEL) {
return PointerChange.CANCEL;
}
if (maskedAction == MotionEvent.ACTION_SCROLL) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the relationship between scrolling and hovering? They seem to be showing up in pairs...

Copy link
Member Author

Choose a reason for hiding this comment

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

The iOS embedding looked like it was encoding scroll events as (PointerChange=hover, PointerSignal=scroll), so I duplicated that.

fwiw, it looks like the PointerEventConverter logic in the framework will consider any event with PointerSignal=scroll to be a scroll event regardless of the PointerChange type.

Copy link
Contributor

@stuartmorgan-g stuartmorgan-g Mar 13, 2019

Choose a reason for hiding this comment

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

The intent is that discrete scroll events use hover, while trackpad gesture scrolling (on platforms that support it as something other than just a sequence of individual scrolls, such as macOS) would use down/move/up sequences. Only the former is implemented in the framework currently, which is why it doesn't check the type, but in the future it will (unless that design changes).

Copy link
Contributor

Choose a reason for hiding this comment

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

@stuartmorgan is that documented anywhere? If not, can we document here or in an appropriate place that is referenced from here (not holding up this PR for that).

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not currently documented.

Documenting it sounds good; suggestions on an appropriate place? It seems like there should really be a document about pointer event streams in general, but if there is one I'm not sure where. (E.g., the only reason I know the distinction between kMove and kHover in general, or what kAdd and kRemove are for, is because I've read the converter code.) Perhaps this falls under the bug about documenting the embedding API in general?

Copy link
Contributor

Choose a reason for hiding this comment

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

A thorough explanation in a Wiki doc would probably be good. I would then try to provide surrounding context and basic explanation in the code, and then link to the full doc from those comments. Generally speaking, I try to convey as much context in javadoc comments as possible because leaving the IDE for a website is a distraction if it can be avoided.

@jason-simmons jason-simmons merged commit b1b388f into flutter:master Mar 13, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 13, 2019
willlarche pushed a commit to flutter/flutter that referenced this pull request Mar 13, 2019
* 59715b7 Disable build_ios task due to lack of credits. (flutter/engine#8150)

* 9f50dae Look up ICU symbols based on the path to libflutter.so as a fallback (flutter/engine#8139)

* 8b1a299 [Skia] Rollback Skia to 29d5dec9a0783a033b921dc483fb98d565d684f6 (flutter/engine#8151)

* 8be2aca Roll src/third_party/dart 1bd36d694d..674fd0e060 (48 commits) #8152

* 2e42703 Revert "Disable build_ios task due to lack of credits. (#8150)" (flutter/engine#8153)

* 2daebeb Fix text.dart height docs (flutter/engine#8079)

* b1b388f Encode scroll motion events in the Android touch processor (flutter/engine#8149)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 14, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 14, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 14, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 14, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 14, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 14, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 14, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 14, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 14, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 14, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 15, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 15, 2019
RBogie pushed a commit to RBogie/flutter-engine that referenced this pull request Apr 8, 2019
RBogie added a commit to RBogie/flutter-engine that referenced this pull request Apr 8, 2019
RBogie added a commit to RBogie/flutter-engine that referenced this pull request Apr 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants