Skip to content

Commit 810cca7

Browse files
committed
log fix, overlaid playback window
1 parent b280be9 commit 810cca7

File tree

5 files changed

+35
-18
lines changed

5 files changed

+35
-18
lines changed

packages/selenium-ide/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "selenium-ide",
3-
"version": "4.0.1-alpha.73",
3+
"version": "4.0.1-alpha.74",
44
"private": false,
55
"description": "Selenium IDE electron app",
66
"author": "Todd <[email protected]>",

packages/selenium-ide/src/browser/windows/Logger/main.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ const SIDELogger: React.FC = () => {
1313
const logContainer = React.useRef<HTMLPreElement>(null)
1414
React.useEffect(() => {
1515
const handleLog = (level: LogLevel, log: string) => {
16-
logContainer.current?.append(
16+
const el = logContainer.current
17+
if (!el) return;
18+
console.info(el.scrollHeight)
19+
el.append(
1720
`${new Date().toLocaleTimeString()} [${level}] ${log}\n`
1821
)
19-
console.log(logContainer.current?.scrollHeight)
20-
window.scrollTo(0, logContainer.current?.scrollHeight ?? 0)
22+
el.scrollTo(0, el.scrollHeight)
2123
}
2224
window.sideAPI.system.onLog.addListener(handleLog)
2325
return () => {
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import { WindowConfig } from 'browser/types'
22

33
export const window: WindowConfig['window'] = () => ({
4-
title: 'Playback Window',
4+
alwaysOnTop: true,
5+
frame: false,
56
resizable: false,
7+
roundedCorners: false,
8+
show: false,
9+
title: 'Playback Window',
610
})

packages/selenium-ide/src/main/session/controllers/ResizablePanels/index.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,24 @@ export default class ResizablePanelsController extends BaseController {
2626
resizablePanelDefaults?.[id] ?? [50, 50]
2727
)
2828
}
29+
async recalculatePlaybackWindows() {
30+
const panelScreenPosition = await this.getPanelScreenPosition(
31+
'playback-panel'
32+
)
33+
this.session.windows.playbackWindows.forEach((playbackWindow) => {
34+
playbackWindow.setSize(
35+
panelScreenPosition.width,
36+
panelScreenPosition.height,
37+
)
38+
playbackWindow.setPosition(
39+
panelScreenPosition.x,
40+
panelScreenPosition.y,
41+
)
42+
})
43+
}
2944
async setPanelGroup(id: string, dimensions: number[]) {
3045
this.session.store.set(`panelGroup.${id}`, dimensions)
46+
this.recalculatePlaybackWindows()
3147
}
3248
async getPanelScreenPosition(id: string) {
3349
const projectWindow = await this.session.windows.get('project-main-window')
@@ -37,10 +53,10 @@ export default class ResizablePanelsController extends BaseController {
3753
`JSON.parse(JSON.stringify(document.querySelector('[data-panel-id="${id}"]').getBoundingClientRect()))`
3854
)) as Rect
3955
return {
40-
x: Math.round(panelGroupPosition.x + projectWindowBounds.x) + 11,
41-
y: Math.round(panelGroupPosition.y + projectWindowBounds.y) + 38,
42-
width: Math.round(panelGroupPosition.width) - 24,
43-
height: Math.round(panelGroupPosition.height) - 20,
56+
x: Math.round(panelGroupPosition.x + projectWindowBounds.x) + 2,
57+
y: Math.round(panelGroupPosition.y + projectWindowBounds.y) + 30,
58+
width: Math.round(panelGroupPosition.width) - 5,
59+
height: Math.round(panelGroupPosition.height) - 3,
4460
}
4561
}
4662
}

packages/selenium-ide/src/main/session/controllers/Windows/index.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,10 @@ export default class WindowsController extends BaseController {
240240
const window = this.windowLoaders[playbackWindowName]({
241241
...opts,
242242
...playbackScreenPosition,
243+
parent: await this.session.windows.get(projectEditorWindowName),
243244
})
244245
this.handlePlaybackWindow(window)
246+
window.showInactive()
245247
if (opts.title) {
246248
window.webContents.executeJavaScript(`document.title = "${opts.title}";`)
247249
}
@@ -363,15 +365,8 @@ export default class WindowsController extends BaseController {
363365
await this.open(projectEditorWindowName, { show: false })
364366
const projectWindow = await this.get(projectEditorWindowName)
365367
this.useWindowState(projectWindow, 'windowSize', 'windowPosition')
366-
projectWindow.on('focus', () => {
367-
this.playbackWindows.forEach((bw) => {
368-
bw.setAlwaysOnTop(true)
369-
})
370-
})
371-
projectWindow.on('blur', () => {
372-
this.playbackWindows.forEach((bw) => {
373-
bw.setAlwaysOnTop(false)
374-
})
368+
projectWindow.on('resize', () => {
369+
this.session.resizablePanels.recalculatePlaybackWindows()
375370
})
376371

377372
projectWindow.show()

0 commit comments

Comments
 (0)