Lf94/hidpi hovering fix (#5541)
* Fix hover highlights on HiDPI screens * Fix flakey tests with new toolbar.exitSketch * tsc && lint && fmt * Disable pw electron thing again * Fix test --------- Co-authored-by: 49lf <ircsurfer33@gmail.com>
This commit is contained in:
@ -161,25 +161,20 @@ export function toSync<F extends AsyncFn<F>>(
|
||||
}
|
||||
}
|
||||
|
||||
export function getNormalisedCoordinates({
|
||||
clientX,
|
||||
clientY,
|
||||
streamWidth,
|
||||
streamHeight,
|
||||
el,
|
||||
}: {
|
||||
clientX: number
|
||||
clientY: number
|
||||
streamWidth: number
|
||||
streamHeight: number
|
||||
el: HTMLElement
|
||||
}) {
|
||||
const { left, top, width, height } = el?.getBoundingClientRect()
|
||||
const browserX = clientX - left
|
||||
const browserY = clientY - top
|
||||
export function getNormalisedCoordinates(
|
||||
e: PointerEvent | React.MouseEvent<HTMLDivElement, MouseEvent>,
|
||||
elVideo: HTMLVideoElement,
|
||||
streamDimensions: {
|
||||
width: number
|
||||
height: number
|
||||
}
|
||||
) {
|
||||
const { left, top, width, height } = elVideo?.getBoundingClientRect()
|
||||
const browserX = e.clientX - left
|
||||
const browserY = e.clientY - top
|
||||
return {
|
||||
x: Math.round((browserX / width) * streamWidth),
|
||||
y: Math.round((browserY / height) * streamHeight),
|
||||
x: Math.round((browserX / width) * streamDimensions.width),
|
||||
y: Math.round((browserY / height) * streamDimensions.height),
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user