Revert "Correct hovering highlights on HiDPI screens + correct 2 flakey tests" (#5535)
* Revert "Correct hovering highlights on HiDPI screens + correct 2 flakey tests…"
This reverts commit 5743b9ced0.
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
@ -646,17 +646,16 @@ export function codeToIdSelections(
|
||||
}
|
||||
|
||||
export async function sendSelectEventToEngine(
|
||||
e: React.MouseEvent<HTMLDivElement, MouseEvent>
|
||||
e: MouseEvent | React.MouseEvent<HTMLDivElement, MouseEvent>,
|
||||
el: HTMLVideoElement
|
||||
) {
|
||||
// No video stream to normalise against, return immediately
|
||||
if (!engineCommandManager.elVideo)
|
||||
return Promise.reject('video element not ready')
|
||||
|
||||
const { x, y } = getNormalisedCoordinates(
|
||||
e,
|
||||
engineCommandManager.elVideo,
|
||||
engineCommandManager.streamDimensions
|
||||
)
|
||||
const { x, y } = getNormalisedCoordinates({
|
||||
clientX: e.clientX,
|
||||
clientY: e.clientY,
|
||||
el,
|
||||
streamWidth: engineCommandManager.width,
|
||||
streamHeight: engineCommandManager.height,
|
||||
})
|
||||
const res = await engineCommandManager.sendSceneCommand({
|
||||
type: 'modeling_cmd_req',
|
||||
cmd: {
|
||||
|
||||
@ -161,20 +161,25 @@ export function toSync<F extends AsyncFn<F>>(
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
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
|
||||
return {
|
||||
x: Math.round((browserX / width) * streamDimensions.width),
|
||||
y: Math.round((browserY / height) * streamDimensions.height),
|
||||
x: Math.round((browserX / width) * streamWidth),
|
||||
y: Math.round((browserY / height) * streamHeight),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user