本文整理匯總了TypeScript中electron.BrowserWindow.getBounds方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript BrowserWindow.getBounds方法的具體用法?TypeScript BrowserWindow.getBounds怎麽用?TypeScript BrowserWindow.getBounds使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類electron.BrowserWindow
的用法示例。
在下文中一共展示了BrowserWindow.getBounds方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: debounce
const debouncedBounds = debounce(() => {
if (nativeWindow.isDestroyed()) {
return;
}
const windowBounds = nativeWindow.getBounds();
store.dispatch(actions.windBoundsChanged({ wind, bounds: windowBounds }));
}, 2000);
示例2: getSettings
mainWindow.on('restore', () => {
if (windowIsOffScreen(mainWindow.getBounds())) {
const bounds = mainWindow.getBounds();
let display = Electron.screen.getAllDisplays().find(display => display.id === getSettings().windowState.displayId);
display = display || Electron.screen.getDisplayMatching(bounds);
mainWindow.setPosition(display.workArea.x, display.workArea.y);
dispatch<WindowStateAction>({
type: 'Window_RememberBounds',
state: {
displayId: display.id,
width: bounds.width,
height: bounds.height,
left: display.workArea.x,
top: display.workArea.y
}
});
}
});
示例3: _saveState
private _saveState(): void {
const isMaximized = this._window.isMaximized()
const isFullScreen = this._window.isFullScreen()
this._state = { isFullScreen, isMaximized }
if (!(isMaximized || isFullScreen)) {
this._state.bounds = this._window.getBounds()
}
appConfig.set(this._stateName, this._state as any)
}
示例4:
const rememberBounds = () => {
const bounds = mainWindow.getBounds();
dispatch<WindowStateAction>({
type: 'Window_RememberBounds',
state: {
displayId: Electron.screen.getDisplayMatching(bounds).id,
width: bounds.width,
height: bounds.height,
left: bounds.x,
top: bounds.y
}
});
}
示例5: function
win.on("close", function () {
var data = {
bounds: win.getBounds()
};
writeFileSync(initPath, JSON.stringify(data));
});
示例6:
window.on('move', () => {
if (!window.isMaximized()) {
windowState.bounds = window.getBounds();
}
});