mirror of
https://github.com/HiMeditator/auto-caption.git
synced 2026-02-14 03:24:44 +08:00
feat(engine): 添加字幕窗口宽度记忆功能并优化字幕引擎关闭逻辑
- 添加 captionWindowWidth 属性,用于保存字幕窗口宽度 - 修改 CaptionEngine 中的 stop 和 kill 方法,优化字幕引擎关闭逻辑 - 更新 README,添加预备模型列表
This commit is contained in:
@@ -3,6 +3,7 @@ import path from 'path'
|
||||
import { is } from '@electron-toolkit/utils'
|
||||
import icon from '../../build/icon.png?asset'
|
||||
import { controlWindow } from './ControlWindow'
|
||||
import { allConfig } from './utils/AllConfig'
|
||||
|
||||
class CaptionWindow {
|
||||
window: BrowserWindow | undefined;
|
||||
@@ -10,7 +11,7 @@ class CaptionWindow {
|
||||
public createWindow(): void {
|
||||
this.window = new BrowserWindow({
|
||||
icon: icon,
|
||||
width: 900,
|
||||
width: allConfig.captionWindowWidth,
|
||||
height: 100,
|
||||
minWidth: 480,
|
||||
show: false,
|
||||
@@ -30,6 +31,12 @@ class CaptionWindow {
|
||||
this.window?.show()
|
||||
})
|
||||
|
||||
this.window.on('close', () => {
|
||||
if(this.window) {
|
||||
allConfig.captionWindowWidth = this.window?.getBounds().width;
|
||||
}
|
||||
})
|
||||
|
||||
this.window.on('closed', () => {
|
||||
this.window = undefined
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user