mirror of
https://github.com/google/blockly.git
synced 2026-01-07 17:10:11 +01:00
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:
@@ -211,9 +211,9 @@ export class Scrollbar {
|
||||
}
|
||||
|
||||
this.onMouseDownBarWrapper_ = browserEvents.conditionalBind(
|
||||
this.svgBackground, 'mousedown', this, this.onMouseDownBar);
|
||||
this.svgBackground, 'pointerdown', this, this.onMouseDownBar);
|
||||
this.onMouseDownHandleWrapper_ = browserEvents.conditionalBind(
|
||||
this.svgHandle, 'mousedown', this, this.onMouseDownHandle);
|
||||
this.svgHandle, 'pointerdown', this, this.onMouseDownHandle);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -703,7 +703,7 @@ export class Scrollbar {
|
||||
*
|
||||
* @param e Mouse down event.
|
||||
*/
|
||||
private onMouseDownHandle(e: MouseEvent) {
|
||||
private onMouseDownHandle(e: PointerEvent) {
|
||||
this.workspace.markFocused();
|
||||
this.cleanUp();
|
||||
if (browserEvents.isRightButton(e)) {
|
||||
@@ -723,9 +723,9 @@ export class Scrollbar {
|
||||
// Record the current mouse position.
|
||||
this.startDragMouse = this.horizontal ? e.clientX : e.clientY;
|
||||
this.onMouseUpWrapper_ = browserEvents.conditionalBind(
|
||||
document, 'mouseup', this, this.onMouseUpHandle);
|
||||
document, 'pointerup', this, this.onMouseUpHandle);
|
||||
this.onMouseMoveWrapper_ = browserEvents.conditionalBind(
|
||||
document, 'mousemove', this, this.onMouseMoveHandle);
|
||||
document, 'pointermove', this, this.onMouseMoveHandle);
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}
|
||||
@@ -735,7 +735,7 @@ export class Scrollbar {
|
||||
*
|
||||
* @param e Mouse move event.
|
||||
*/
|
||||
private onMouseMoveHandle(e: MouseEvent) {
|
||||
private onMouseMoveHandle(e: PointerEvent) {
|
||||
const currentMouse = this.horizontal ? e.clientX : e.clientY;
|
||||
const mouseDelta = currentMouse - this.startDragMouse;
|
||||
const handlePosition = this.startDragHandle + mouseDelta;
|
||||
|
||||
Reference in New Issue
Block a user