From 39c62f3b9cd31115d1c7ffdd54b28e577d612341 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Wed, 27 Jul 2022 22:21:20 -0500 Subject: [PATCH] Made trackHover less intrusive --- src/util/vue.tsx | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/src/util/vue.tsx b/src/util/vue.tsx index 16bb826..3220770 100644 --- a/src/util/vue.tsx +++ b/src/util/vue.tsx @@ -214,39 +214,13 @@ export function processedPropType(...types: PropTypes[]): PropType { - const elementComponent = element[ComponentKey]; const isHovered = ref(false); - element[ComponentKey] = defineComponent({ - props: { - element: { - type: Object as PropType, - required: true - } - }, - setup: function (props) { - const element = toRef(props, "element"); - - onUnmounted(() => (isHovered.value = false)); - return () => ( -
(isHovered.value = true)} - onPointerleave={() => (isHovered.value = false)} - > - {/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */} - {unwrapRef(element) == null ? "" : renderJSX(unwrapRef(element)!)} -
- ); - } - }) as GenericComponent; - const elementGatherProps = element[GatherProps].bind(element); element[GatherProps] = () => ({ - element: { - [ComponentKey]: elementComponent, - [GatherProps]: elementGatherProps - } + ...elementGatherProps(), + onPointerenter: () => (isHovered.value = true), + onPointerleave: () => (isHovered.value = false) }); return isHovered;