useMouseInElement

Provides the mouse position relative to an element

Demo

Move your mouse around

Usage

const const ref: Kaioken.MutableRefObject<HTMLElement | null>ref = useRef<HTMLElement | null>(initialValue: HTMLElement | null): Kaioken.MutableRefObject<HTMLElement | null> (+2 overloads)useRef<HTMLElement | null>(null)
const 
const result: {
    x: ComputedSignal<number>;
    y: ComputedSignal<number>;
    ... 6 more ...;
    isOutside: Signal<...>;
}
result
=
function useMouseInElement(target: Kaioken.MutableRefObject<HTMLElement | null>): {
    x: ComputedSignal<number>;
    y: ComputedSignal<number>;
    elementX: Signal<number>;
    elementY: Signal<number>;
    elementPositionX: Signal<...>;
    elementPositionY: Signal<...>;
    elementHeight: Signal<...>;
    elementWidth: Signal<...>;
    isOutside: Signal<...>;
}
useMouseInElement
(const ref: Kaioken.MutableRefObject<HTMLElement | null>ref)