MCPcopy Create free account
hub / github.com/ZToolsCenter/ZTools / resizeWindow

Method resizeWindow

src/main/api/renderer/window.ts:90–110  ·  view source on GitHub ↗
(height: number)

Source from the content-addressed store, hash-verified

88 }
89
90 public resizeWindow(height: number): void {
91 if (this.mainWindow) {
92 // 使用固定宽度常量,避免多显示器 DPI 缩放导致 getSize() 返回被缩放的值
93 const width = WINDOW_WIDTH
94 // 限制高度范围: 最小初始高度, 最大不超过当前屏幕可用高度
95 const display = screen.getDisplayNearestPoint(screen.getCursorScreenPoint())
96 const maxHeight = display.workAreaSize.height
97 const newHeight = Math.max(WINDOW_INITIAL_HEIGHT, Math.min(height, maxHeight))
98
99 this.mainWindow.setBounds({
100 width,
101 height: newHeight
102 })
103
104 // 如果当前处于锁定状态,更新锁定的尺寸
105 if (this.lockedSize) {
106 this.lockedSize = { width, height: newHeight }
107 console.log('[WindowAPI] 更新锁定尺寸:', this.lockedSize)
108 }
109 }
110 }
111
112 public getWindowPosition(): { x: number; y: number } {
113 if (this.mainWindow) {

Callers 1

setupIPCMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected