-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(activator): cancel remove .activated timeout
- Loading branch information
1 parent
bb80033
commit 9510a2b
Showing
6 changed files
with
290 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { PointerCoordinates } from '../../util/dom'; | ||
|
||
export abstract class ActivatorBase { | ||
|
||
abstract clickAction(ev, activatableEle: HTMLElement, startCoord: PointerCoordinates); | ||
|
||
abstract downAction(ev: UIEvent, activatableEle: HTMLElement, startCoord: PointerCoordinates); | ||
|
||
abstract upAction(ev: UIEvent, activatableEle: HTMLElement, startCoord: PointerCoordinates); | ||
|
||
abstract clearState(); | ||
} | ||
|
||
export function isActivatedDisabled(ev: any, activatableEle: any): boolean { | ||
if (!activatableEle || !activatableEle.parentNode) { | ||
return true; | ||
} | ||
if (!ev) { | ||
return false; | ||
} | ||
if (ev.defaultPrevented) { | ||
return true; | ||
} | ||
|
||
let targetEle = ev.target; | ||
for (let i = 0; i < 4; i++) { | ||
if (!targetEle) { | ||
break; | ||
} | ||
if (targetEle.hasAttribute('disable-activated')) { | ||
return true; | ||
} | ||
targetEle = targetEle.parentElement; | ||
} | ||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.