當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript BrowserWindow.setBounds方法代碼示例

本文整理匯總了TypeScript中electron.BrowserWindow.setBounds方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript BrowserWindow.setBounds方法的具體用法?TypeScript BrowserWindow.setBounds怎麽用?TypeScript BrowserWindow.setBounds使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在electron.BrowserWindow的用法示例。


在下文中一共展示了BrowserWindow.setBounds方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: _setBounds

 private _setBounds(): void {
   if (this._state.isFullScreen) {
     this._window.setFullScreen(true)
   } else if (this._state.isMaximized) {
     this._window.maximize()
   } else {
     this._window.setBounds(this._state.bounds!)
   }
 }
開發者ID:,項目名稱:,代碼行數:9,代碼來源:

示例2: async

  watcher.on(actions.openWind, async (store, action) => {
    let { initialURL } = action.payload;
    const rs = store.getState();

    initialURL = normalizeURL(initialURL);

    const secondaryWindowParams = opensInWindow(initialURL);
    if (secondaryWindowParams) {
      // see if we already have a window with that initialURL
      for (const wind of Object.keys(rs.winds)) {
        const windState = rs.winds[wind];
        if (windState.properties.initialURL === initialURL) {
          const nativeWin = getNativeWindow(rs, wind);
          if (nativeWin) {
            nativeWin.show();
            nativeWin.focus();
            return;
          }
        }
      }
    }

    let width = 800;
    let height = 600;
    if (secondaryWindowParams) {
      width = secondaryWindowParams.width || width;
      height = secondaryWindowParams.height || height;
    }
    const opts: BrowserWindowConstructorOptions = {
      ...commonBrowserWindowOpts(store),
      title: app.getName(),
      width,
      height,
    };

    const nativeWindow = new BrowserWindow(opts);
    const wind = `secondary-${secondaryWindowSeed++}`;
    const role: WindRole = "secondary";
    store.dispatch(
      actions.windOpened({
        wind,
        role,
        nativeId: nativeWindow.id,
        initialURL: initialURL,
      })
    );

    const configKey = `${initialURL}-bounds`;
    const bounds = config.get(configKey);
    if (bounds) {
      nativeWindow.setBounds(bounds);
    }

    nativeWindow.loadURL(makeAppURL({ wind, role }));
    hookNativeWindow(store, wind, nativeWindow);
  });
開發者ID:itchio,項目名稱:itch,代碼行數:56,代碼來源:winds.ts


注:本文中的electron.BrowserWindow.setBounds方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。