refactor: Migrate to PointerEvents (#6598)

* refactor: Remove checks for PointerEvent support.

* refactor: Deprecate and remove calls to splitEventByTouches.

* refactor: Deprecate and remove calls to setClientFromTouch().

* refactor: Use PointerEvent in place of Event/MouseEvent/TouchEvent/PseudoEvent.

* refactor: Update references to mouse/touch events in code and documentation to reference pointer events.

* refactor: Merge Gesture and TouchGesture

* chore: clang-format changed files

* refactor: Bind and expect PointerEvents instead of MouseEvents.

* refactor: Rename TouchGesture to Gesture.

* fix: Fix test failures.

* chore: clang-format changed files.

* fix: Fix errant _ from merging

* refactor: Clean up dead code in browser_events.ts.

* chore: Update version in deprecation notices to reflect release schedule

* fix: Fixed a bug that caused the browser context menu to not be suppressed in Chrome.

* fix: Re-export Gesture as TouchGesture for backwards compatibility.

* refactor: Deprecate and remove uses of opt_noPreventDefault.

* chore: Fix error message in gesture.ts.

* chore: Removed obsolete todo.
This commit is contained in:
Aaron Dodson
2022-12-05 11:27:52 -08:00
committed by GitHub
parent 9741cd2530
commit 90cb965e7c
30 changed files with 545 additions and 806 deletions

View File

@@ -231,14 +231,14 @@ export function createDom() {
export function bindMouseEvents(element: Element) {
// TODO (#6097): Don't stash wrapper info on the DOM.
(element as AnyDuringMigration).mouseOverWrapper_ =
browserEvents.bind(element, 'mouseover', null, onMouseOver);
browserEvents.bind(element, 'pointerover', null, onMouseOver);
(element as AnyDuringMigration).mouseOutWrapper_ =
browserEvents.bind(element, 'mouseout', null, onMouseOut);
browserEvents.bind(element, 'pointerout', null, onMouseOut);
// Don't use bindEvent_ for mousemove since that would create a
// corresponding touch handler, even though this only makes sense in the
// context of a mouseover/mouseout.
element.addEventListener('mousemove', onMouseMove, false);
element.addEventListener('pointermove', onMouseMove, false);
}
/**
@@ -254,7 +254,7 @@ export function unbindMouseEvents(element: Element|null) {
// TODO (#6097): Don't stash wrapper info on the DOM.
browserEvents.unbind((element as AnyDuringMigration).mouseOverWrapper_);
browserEvents.unbind((element as AnyDuringMigration).mouseOutWrapper_);
element.removeEventListener('mousemove', onMouseMove);
element.removeEventListener('pointermove', onMouseMove);
}
/**
@@ -263,7 +263,7 @@ export function unbindMouseEvents(element: Element|null) {
*
* @param e Mouse event.
*/
function onMouseOver(e: Event) {
function onMouseOver(e: PointerEvent) {
if (blocked) {
// Someone doesn't want us to show tooltips.
return;
@@ -285,7 +285,7 @@ function onMouseOver(e: Event) {
*
* @param _e Mouse event.
*/
function onMouseOut(_e: Event) {
function onMouseOut(_e: PointerEvent) {
if (blocked) {
// Someone doesn't want us to show tooltips.
return;