mirror of
https://github.com/google/blockly.git
synced 2026-01-08 09:30:06 +01:00
fix!: remove checks for IE and EdgeHTML in core (#6336)
* chore: remove uses of userAgent.IE * chore!: remove export of userAgent.IE * format: run format * fix!: remove special-cases for EdgeHTML browser engine * fix!: remove export of userAgent.EDGE * chore: remove unused dependencies * fix: touch events in non-touch firefox
This commit is contained in:
@@ -89,12 +89,16 @@ let longPid_: AnyDuringMigration = 0;
|
||||
export function longStart(e: Event, gesture: Gesture) {
|
||||
longStop();
|
||||
// Punt on multitouch events.
|
||||
if (e instanceof TouchEvent && e.changedTouches &&
|
||||
e.changedTouches.length !== 1) {
|
||||
// AnyDuringMigration because: Property 'changedTouches' does not exist on
|
||||
// type 'Event'.
|
||||
if ((e as AnyDuringMigration).changedTouches &&
|
||||
(e as AnyDuringMigration).changedTouches.length !== 1) {
|
||||
return;
|
||||
}
|
||||
longPid_ = setTimeout(function() {
|
||||
// TODO(#6097): Make types accurate, possibly by refactoring touch handling.
|
||||
// AnyDuringMigration because: Property 'changedTouches' does not exist on
|
||||
// type 'Event'.
|
||||
const typelessEvent = e as AnyDuringMigration;
|
||||
// Additional check to distinguish between touch events and pointer events
|
||||
if (typelessEvent.changedTouches) {
|
||||
@@ -280,11 +284,17 @@ export function isTouchEvent(e: Event|PseudoEvent): boolean {
|
||||
*/
|
||||
export function splitEventByTouches(e: Event): Array<Event|PseudoEvent> {
|
||||
const events = [];
|
||||
if (e instanceof TouchEvent) {
|
||||
for (let i = 0; i < e.changedTouches.length; i++) {
|
||||
// AnyDuringMigration because: Property 'changedTouches' does not exist on
|
||||
// type 'PseudoEvent | Event'.
|
||||
if ((e as AnyDuringMigration).changedTouches) {
|
||||
// AnyDuringMigration because: Property 'changedTouches' does not exist on
|
||||
// type 'PseudoEvent | Event'.
|
||||
for (let i = 0; i < (e as AnyDuringMigration).changedTouches.length; i++) {
|
||||
const newEvent = {
|
||||
type: e.type,
|
||||
changedTouches: [e.changedTouches[i]],
|
||||
// AnyDuringMigration because: Property 'changedTouches' does not exist
|
||||
// on type 'PseudoEvent | Event'.
|
||||
changedTouches: [(e as AnyDuringMigration).changedTouches[i]],
|
||||
target: e.target,
|
||||
stopPropagation() {
|
||||
e.stopPropagation();
|
||||
|
||||
Reference in New Issue
Block a user