Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/common/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ export interface TapGestureState extends GestureState {
clientY: number;
pageX: number;
pageY: number;
isRightButton?: boolean; // UWP only, for desktop context menu
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For consistency with MouseEvent, this should be called "button", it should return the integer corresponding to the button, and it should be implemented for all mouse-based platforms (not just UWP).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also, since this is an addition to the public interface, it will need to be documented (in GestureView.md) and added to the ReactXP test app (GestureViewTest.tsx).

}

export enum GestureMouseCursor {
Expand Down Expand Up @@ -1197,6 +1198,7 @@ export interface TouchEvent extends SyntheticEvent {
pageX?: number;
pageY?: number;
touches: TouchList;
isRightButton?: boolean; // UWP only
}

export interface WheelEvent extends SyntheticEvent {
Expand Down
2 changes: 1 addition & 1 deletion src/native-common/GestureView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ export abstract class GestureView extends ViewBase<Types.GestureViewProps, {}> {
return panEvent;
}

private _sendTapEvent(e: Types.TouchEvent) {
protected _sendTapEvent(e: Types.TouchEvent) {
if (this.props.onTap) {
const tapEvent: Types.TapGestureState = {
pageX: e.pageX!!!,
Expand Down
17 changes: 16 additions & 1 deletion src/windows/GestureView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class GestureView extends BaseGestureView {
super(props);
}

protected _getPreferredPanRatio(): number {
protected _getPreferredPanRatio(): number {
return _preferredPanRatio;
}

Expand All @@ -37,6 +37,21 @@ export class GestureView extends BaseGestureView {

return timestamp.valueOf();
}

protected _sendTapEvent(e: Types.TouchEvent) {
if (this.props.onTap) {
const tapEvent: Types.TapGestureState = {
pageX: e.pageX!!!,
pageY: e.pageY!!!,
clientX: e.locationX!!!,
clientY: e.locationY!!!,
timeStamp: e.timeStamp,
isRightButton: e.isRightButton
};

this.props.onTap(tapEvent);
}
}
}

export default GestureView;