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:
@ -82,16 +82,6 @@ export class ToolbarFixture {
|
|||||||
startSketchPlaneSelection = async () =>
|
startSketchPlaneSelection = async () =>
|
||||||
doAndWaitForImageDiff(this.page, () => this.startSketchBtn.click(), 500)
|
doAndWaitForImageDiff(this.page, () => this.startSketchBtn.click(), 500)
|
||||||
|
|
||||||
exitSketch = async () => {
|
|
||||||
await this.exitSketchBtn.click()
|
|
||||||
await expect(
|
|
||||||
this.page.getByRole('button', { name: 'Start Sketch' })
|
|
||||||
).toBeVisible()
|
|
||||||
await expect(
|
|
||||||
this.page.getByRole('button', { name: 'Start Sketch' })
|
|
||||||
).not.toBeDisabled()
|
|
||||||
}
|
|
||||||
|
|
||||||
editSketch = async () => {
|
editSketch = async () => {
|
||||||
await this.editSketchBtn.first().click()
|
await this.editSketchBtn.first().click()
|
||||||
// One of the rare times we want to allow a arbitrary wait
|
// One of the rare times we want to allow a arbitrary wait
|
||||||
|
@ -170,7 +170,8 @@ test.describe('Point-and-click tests', { tag: ['@skipWin'] }, () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
await test.step('Clean up so that `_sketchOnAChamfer` util can be called again', async () => {
|
await test.step('Clean up so that `_sketchOnAChamfer` util can be called again', async () => {
|
||||||
await toolbar.exitSketch()
|
await toolbar.exitSketchBtn.click()
|
||||||
|
await scene.waitForExecutionDone()
|
||||||
})
|
})
|
||||||
await test.step('Check there is no errors after code created in previous steps executes', async () => {
|
await test.step('Check there is no errors after code created in previous steps executes', async () => {
|
||||||
await editor.expectState({
|
await editor.expectState({
|
||||||
@ -201,9 +202,7 @@ test.describe('Point-and-click tests', { tag: ['@skipWin'] }, () => {
|
|||||||
}, file)
|
}, file)
|
||||||
await page.setBodyDimensions({ width: 1000, height: 500 })
|
await page.setBodyDimensions({ width: 1000, height: 500 })
|
||||||
await homePage.goToModelingScene()
|
await homePage.goToModelingScene()
|
||||||
await expect(
|
await scene.waitForExecutionDone()
|
||||||
page.getByTestId('model-state-indicator-receive-reliable')
|
|
||||||
).toBeVisible()
|
|
||||||
|
|
||||||
const sketchOnAChamfer = _sketchOnAChamfer(page, editor, toolbar, scene)
|
const sketchOnAChamfer = _sketchOnAChamfer(page, editor, toolbar, scene)
|
||||||
|
|
||||||
@ -391,7 +390,6 @@ profile001 = startProfileAt([205.96, 254.59], sketch002)
|
|||||||
}, file)
|
}, file)
|
||||||
await page.setBodyDimensions({ width: 1000, height: 500 })
|
await page.setBodyDimensions({ width: 1000, height: 500 })
|
||||||
await homePage.goToModelingScene()
|
await homePage.goToModelingScene()
|
||||||
|
|
||||||
await scene.waitForExecutionDone()
|
await scene.waitForExecutionDone()
|
||||||
|
|
||||||
const sketchOnAChamfer = _sketchOnAChamfer(page, editor, toolbar, scene)
|
const sketchOnAChamfer = _sketchOnAChamfer(page, editor, toolbar, scene)
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 49 KiB |
Binary file not shown.
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 55 KiB |
@ -29,5 +29,5 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"kcl_version": "0.2.38"
|
"kcl_version": "0.2.39"
|
||||||
}
|
}
|
@ -775,7 +775,7 @@ profile003 = startProfileAt([40.16, -120.48], sketch006)
|
|||||||
)
|
)
|
||||||
`)
|
`)
|
||||||
await expect(
|
await expect(
|
||||||
page.getByTestId('model-state-indicator-receive-reliable')
|
page.getByTestId('model-state-indicator-execution-done')
|
||||||
).toBeVisible()
|
).toBeVisible()
|
||||||
|
|
||||||
await u.openAndClearDebugPanel()
|
await u.openAndClearDebugPanel()
|
||||||
|
@ -22,7 +22,7 @@ import {
|
|||||||
UnreliableSubscription,
|
UnreliableSubscription,
|
||||||
} from 'lang/std/engineConnection'
|
} from 'lang/std/engineConnection'
|
||||||
import { EngineCommand } from 'lang/std/artifactGraph'
|
import { EngineCommand } from 'lang/std/artifactGraph'
|
||||||
import { toSync, uuidv4, getNormalisedCoordinates } from 'lib/utils'
|
import { toSync, uuidv4 } from 'lib/utils'
|
||||||
import { deg2Rad } from 'lib/utils2d'
|
import { deg2Rad } from 'lib/utils2d'
|
||||||
import { isReducedMotion, roundOff, throttle } from 'lib/utils'
|
import { isReducedMotion, roundOff, throttle } from 'lib/utils'
|
||||||
import * as TWEEN from '@tweenjs/tween.js'
|
import * as TWEEN from '@tweenjs/tween.js'
|
||||||
@ -109,7 +109,6 @@ export class CameraControls {
|
|||||||
interactionGuards: MouseGuard = cameraMouseDragGuards.Zoo
|
interactionGuards: MouseGuard = cameraMouseDragGuards.Zoo
|
||||||
isFovAnimationInProgress = false
|
isFovAnimationInProgress = false
|
||||||
perspectiveFovBeforeOrtho = 45
|
perspectiveFovBeforeOrtho = 45
|
||||||
|
|
||||||
// NOTE: Duplicated state across Provider and singleton. Mapped from settingsMachine
|
// NOTE: Duplicated state across Provider and singleton. Mapped from settingsMachine
|
||||||
_setting_allowOrbitInSketchMode = false
|
_setting_allowOrbitInSketchMode = false
|
||||||
get isPerspective() {
|
get isPerspective() {
|
||||||
@ -457,19 +456,11 @@ export class CameraControls {
|
|||||||
if (this.syncDirection === 'engineToClient') {
|
if (this.syncDirection === 'engineToClient') {
|
||||||
const newCmdId = uuidv4()
|
const newCmdId = uuidv4()
|
||||||
|
|
||||||
// Nonsense to do anything until the video stream is established.
|
|
||||||
if (!this.engineCommandManager.elVideo) return
|
|
||||||
|
|
||||||
const { x, y } = getNormalisedCoordinates(
|
|
||||||
event,
|
|
||||||
this.engineCommandManager.elVideo,
|
|
||||||
this.engineCommandManager.streamDimensions
|
|
||||||
)
|
|
||||||
this.throttledEngCmd({
|
this.throttledEngCmd({
|
||||||
type: 'modeling_cmd_req',
|
type: 'modeling_cmd_req',
|
||||||
cmd: {
|
cmd: {
|
||||||
type: 'highlight_set_entity',
|
type: 'highlight_set_entity',
|
||||||
selected_at_window: { x, y },
|
selected_at_window: { x: event.clientX, y: event.clientY },
|
||||||
},
|
},
|
||||||
cmd_id: newCmdId,
|
cmd_id: newCmdId,
|
||||||
})
|
})
|
||||||
|
@ -47,8 +47,6 @@ export const Stream = () => {
|
|||||||
overallState === NetworkHealthState.Ok ||
|
overallState === NetworkHealthState.Ok ||
|
||||||
overallState === NetworkHealthState.Weak
|
overallState === NetworkHealthState.Weak
|
||||||
|
|
||||||
engineCommandManager.elVideo = videoRef.current
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute code and show a "building scene message"
|
* Execute code and show a "building scene message"
|
||||||
* in Stream.tsx in the meantime.
|
* in Stream.tsx in the meantime.
|
||||||
@ -274,7 +272,7 @@ export const Stream = () => {
|
|||||||
|
|
||||||
if (btnName(e.nativeEvent).left) {
|
if (btnName(e.nativeEvent).left) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
sendSelectEventToEngine(e)
|
sendSelectEventToEngine(e, videoRef.current)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,7 +294,7 @@ export const Stream = () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
sendSelectEventToEngine(e)
|
sendSelectEventToEngine(e, videoRef.current)
|
||||||
.then(({ entity_id }) => {
|
.then(({ entity_id }) => {
|
||||||
if (!entity_id) {
|
if (!entity_id) {
|
||||||
// No entity selected. This is benign
|
// No entity selected. This is benign
|
||||||
|
@ -101,7 +101,10 @@ export function useSetupEngineManager(
|
|||||||
streamRef?.current?.offsetWidth ?? 0,
|
streamRef?.current?.offsetWidth ?? 0,
|
||||||
streamRef?.current?.offsetHeight ?? 0
|
streamRef?.current?.offsetHeight ?? 0
|
||||||
)
|
)
|
||||||
engineCommandManager.handleResize(engineCommandManager.streamDimensions)
|
engineCommandManager.handleResize({
|
||||||
|
streamWidth: width,
|
||||||
|
streamHeight: height,
|
||||||
|
})
|
||||||
}, 500)
|
}, 500)
|
||||||
|
|
||||||
const onOnline = () => {
|
const onOnline = () => {
|
||||||
|
@ -1447,17 +1447,11 @@ export class EngineCommandManager extends EventTarget {
|
|||||||
commandId: string
|
commandId: string
|
||||||
}
|
}
|
||||||
settings: SettingsViaQueryString
|
settings: SettingsViaQueryString
|
||||||
|
width: number = 1337
|
||||||
streamDimensions = {
|
height: number = 1337
|
||||||
// Random defaults that are overwritten pretty much immediately
|
|
||||||
width: 1337,
|
|
||||||
height: 1337,
|
|
||||||
}
|
|
||||||
|
|
||||||
elVideo: HTMLVideoElement | null = null
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Export intent tracks the intent of the export. If it is null there is no
|
* Export intent traxcks the intent of the export. If it is null there is no
|
||||||
* export in progress. Otherwise it is an enum value of the intent.
|
* export in progress. Otherwise it is an enum value of the intent.
|
||||||
* Another export cannot be started if one is already in progress.
|
* Another export cannot be started if one is already in progress.
|
||||||
*/
|
*/
|
||||||
@ -1560,14 +1554,15 @@ export class EngineCommandManager extends EventTarget {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.streamDimensions = {
|
this.width = width
|
||||||
width,
|
this.height = height
|
||||||
height,
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we already have an engine connection, just need to resize the stream.
|
// If we already have an engine connection, just need to resize the stream.
|
||||||
if (this.engineConnection) {
|
if (this.engineConnection) {
|
||||||
this.handleResize(this.streamDimensions)
|
this.handleResize({
|
||||||
|
streamWidth: width,
|
||||||
|
streamHeight: height,
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1863,22 +1858,27 @@ export class EngineCommandManager extends EventTarget {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
handleResize({ width, height }: { width: number; height: number }) {
|
handleResize({
|
||||||
|
streamWidth,
|
||||||
|
streamHeight,
|
||||||
|
}: {
|
||||||
|
streamWidth: number
|
||||||
|
streamHeight: number
|
||||||
|
}) {
|
||||||
if (!this.engineConnection?.isReady()) {
|
if (!this.engineConnection?.isReady()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.streamDimensions = {
|
this.width = streamWidth
|
||||||
width,
|
this.height = streamHeight
|
||||||
height,
|
|
||||||
}
|
|
||||||
|
|
||||||
const resizeCmd: EngineCommand = {
|
const resizeCmd: EngineCommand = {
|
||||||
type: 'modeling_cmd_req',
|
type: 'modeling_cmd_req',
|
||||||
cmd_id: uuidv4(),
|
cmd_id: uuidv4(),
|
||||||
cmd: {
|
cmd: {
|
||||||
type: 'reconfigure_stream',
|
type: 'reconfigure_stream',
|
||||||
...this.streamDimensions,
|
width: streamWidth,
|
||||||
|
height: streamHeight,
|
||||||
fps: 60,
|
fps: 60,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -646,17 +646,16 @@ export function codeToIdSelections(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function sendSelectEventToEngine(
|
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
|
const { x, y } = getNormalisedCoordinates({
|
||||||
if (!engineCommandManager.elVideo)
|
clientX: e.clientX,
|
||||||
return Promise.reject('video element not ready')
|
clientY: e.clientY,
|
||||||
|
el,
|
||||||
const { x, y } = getNormalisedCoordinates(
|
streamWidth: engineCommandManager.width,
|
||||||
e,
|
streamHeight: engineCommandManager.height,
|
||||||
engineCommandManager.elVideo,
|
})
|
||||||
engineCommandManager.streamDimensions
|
|
||||||
)
|
|
||||||
const res = await engineCommandManager.sendSceneCommand({
|
const res = await engineCommandManager.sendSceneCommand({
|
||||||
type: 'modeling_cmd_req',
|
type: 'modeling_cmd_req',
|
||||||
cmd: {
|
cmd: {
|
||||||
|
@ -161,20 +161,25 @@ export function toSync<F extends AsyncFn<F>>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getNormalisedCoordinates(
|
export function getNormalisedCoordinates({
|
||||||
e: PointerEvent | React.MouseEvent<HTMLDivElement, MouseEvent>,
|
clientX,
|
||||||
elVideo: HTMLVideoElement,
|
clientY,
|
||||||
streamDimensions: {
|
streamWidth,
|
||||||
width: number
|
streamHeight,
|
||||||
height: number
|
el,
|
||||||
}
|
}: {
|
||||||
) {
|
clientX: number
|
||||||
const { left, top, width, height } = elVideo?.getBoundingClientRect()
|
clientY: number
|
||||||
const browserX = e.clientX - left
|
streamWidth: number
|
||||||
const browserY = e.clientY - top
|
streamHeight: number
|
||||||
|
el: HTMLElement
|
||||||
|
}) {
|
||||||
|
const { left, top, width, height } = el?.getBoundingClientRect()
|
||||||
|
const browserX = clientX - left
|
||||||
|
const browserY = clientY - top
|
||||||
return {
|
return {
|
||||||
x: Math.round((browserX / width) * streamDimensions.width),
|
x: Math.round((browserX / width) * streamWidth),
|
||||||
y: Math.round((browserY / height) * streamDimensions.height),
|
y: Math.round((browserY / height) * streamHeight),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user