add UI editor

This commit is contained in:
Ian Richardson
2019-11-05 22:35:12 -06:00
parent 81c3e51342
commit d7c51bcbe6
11 changed files with 570 additions and 17 deletions
+8 -1
View File
@@ -111,7 +111,7 @@ class ActionHandler extends HTMLElement implements ActionHandler {
if (this.held) {
fireEvent(element as HTMLElement, 'action', { action: 'hold' });
} else if (options.hasDoubleTap) {
if ((ev as MouseEvent).detail === 1) {
if ((ev as MouseEvent).detail === 1 || ev.type === 'keyup') {
this.dblClickTimeout = window.setTimeout(() => {
fireEvent(element as HTMLElement, 'action', { action: 'tap' });
}, 250);
@@ -126,9 +126,16 @@ class ActionHandler extends HTMLElement implements ActionHandler {
window.setTimeout(() => (this.cooldownEnd = false), 100);
};
const handleEnter = (ev: Event): void => {
if ((ev as KeyboardEvent).keyCode === 13) {
return clickEnd(ev);
}
};
element.addEventListener('touchstart', clickStart, { passive: true });
element.addEventListener('touchend', clickEnd);
element.addEventListener('touchcancel', clickEnd);
element.addEventListener('keyup', handleEnter);
// iOS 13 sends a complete normal touchstart-touchend series of events followed by a mousedown-click series.
// That might be a bug, but until it's fixed, this should make action-handler work.