Fixed lifting up on certain elements not stopping the auto-clicker
This commit is contained in:
parent
4ddfc8e07f
commit
7b2b3de788
6 changed files with 52 additions and 3 deletions
|
@ -12,7 +12,6 @@
|
|||
@touchstart="start"
|
||||
@touchend="stop"
|
||||
@touchcancel="stop"
|
||||
:disabled="!unref(canClick)"
|
||||
:class="{
|
||||
feature: true,
|
||||
clickable: true,
|
||||
|
|
|
@ -17,6 +17,7 @@ import {
|
|||
ProcessedComputable
|
||||
} from "@/util/computed";
|
||||
import { createLazyProxy } from "@/util/proxies";
|
||||
import { unref } from "vue";
|
||||
|
||||
export const ClickableType = Symbol("Clickable");
|
||||
|
||||
|
@ -83,6 +84,23 @@ export function createClickable<T extends ClickableOptions>(
|
|||
processComputable(clickable as T, "mark");
|
||||
processComputable(clickable as T, "display");
|
||||
|
||||
if (clickable.onClick) {
|
||||
const onClick = clickable.onClick;
|
||||
clickable.onClick = function () {
|
||||
if (unref(clickable.canClick)) {
|
||||
onClick();
|
||||
}
|
||||
};
|
||||
}
|
||||
if (clickable.onHold) {
|
||||
const onHold = clickable.onHold;
|
||||
clickable.onHold = function () {
|
||||
if (unref(clickable.canClick)) {
|
||||
onHold();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
clickable[GatherProps] = function (this: GenericClickable) {
|
||||
const {
|
||||
display,
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
@touchstart="start"
|
||||
@touchend="stop"
|
||||
@touchcancel="stop"
|
||||
:disabled="!unref(canClick)"
|
||||
>
|
||||
<div v-if="title"><component :is="titleComponent" /></div>
|
||||
<component :is="component" style="white-space: pre-line" />
|
||||
|
|
|
@ -278,6 +278,23 @@ export function createGrid<T extends GridOptions>(
|
|||
processComputable(grid as T, "getTitle");
|
||||
processComputable(grid as T, "getDisplay");
|
||||
|
||||
if (grid.onClick) {
|
||||
const onClick = grid.onClick;
|
||||
grid.onClick = function (id, state) {
|
||||
if (unref((grid as GenericGrid).cells[id].canClick)) {
|
||||
onClick(id, state);
|
||||
}
|
||||
};
|
||||
}
|
||||
if (grid.onHold) {
|
||||
const onHold = grid.onHold;
|
||||
grid.onHold = function (id, state) {
|
||||
if (unref((grid as GenericGrid).cells[id].canClick)) {
|
||||
onHold(id, state);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
grid[GatherProps] = function (this: GenericGrid) {
|
||||
const { visibility, rows, cols, cells, id } = this;
|
||||
return { visibility, rows, cols, cells, id };
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
},
|
||||
unref(style) ?? []
|
||||
]"
|
||||
:disabled="!unref(canClick)"
|
||||
>
|
||||
<component :is="unref(comp)" />
|
||||
</button>
|
||||
|
|
|
@ -101,6 +101,23 @@ export function createTreeNode<T extends TreeNodeOptions>(
|
|||
processComputable(treeNode as T, "style");
|
||||
processComputable(treeNode as T, "mark");
|
||||
|
||||
if (treeNode.onClick) {
|
||||
const onClick = treeNode.onClick;
|
||||
treeNode.onClick = function () {
|
||||
if (unref(treeNode.canClick)) {
|
||||
onClick();
|
||||
}
|
||||
};
|
||||
}
|
||||
if (treeNode.onHold) {
|
||||
const onHold = treeNode.onHold;
|
||||
treeNode.onHold = function () {
|
||||
if (unref(treeNode.canClick)) {
|
||||
onHold();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return treeNode as unknown as TreeNode<T>;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue