当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript screen.getCursorScreenPoint方法代码示例

本文整理汇总了TypeScript中electron.screen.getCursorScreenPoint方法的典型用法代码示例。如果您正苦于以下问题:TypeScript screen.getCursorScreenPoint方法的具体用法?TypeScript screen.getCursorScreenPoint怎么用?TypeScript screen.getCursorScreenPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在electron.screen的用法示例。


在下文中一共展示了screen.getCursorScreenPoint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: BrowserWindow

app.on('ready', () => {
    let cursorPos = screen.getCursorScreenPoint()
    let workAreaSize = screen.getDisplayNearestPoint(cursorPos).workAreaSize

    app.setName('Ansel')

    mainWindow = new BrowserWindow({
        width: 1356,
        height: 768,
        title: 'Ansel',
        titleBarStyle: 'hiddenInset',
        backgroundColor: '#37474f',  // @blue-grey-800
        webPreferences: {
            experimentalFeatures: true,
            blinkFeatures: 'CSSGridLayout'
        }
    })

    if (workAreaSize.width <= 1366 && workAreaSize.height <= 768)
        mainWindow.maximize()

    mainWindow.loadURL('file://' + __dirname + '/../../static/index.html')
    mainWindow.setTitle('Ansel')
    initBackgroundService(mainWindow)
    initForegroundClient(mainWindow)

    //let usb = new Usb()
    //
    //usb.scan((err, drives) => {
    //  mainWindow.webContents.send('scanned-devices', drives)
    //})
    //
    //usb.watch((err, action, drive) => {
    //  if (action === 'add')
    //    mainWindow.webContents.send('add-device', drive)
    //  else
    //    mainWindow.webContents.send('remove-device', drive)
    //})

    if (fs.existsSync(config.settings)) {
        initLibrary(mainWindow)
    } else {
        initDb()
        ipcMain.on('settings-created', () => initLibrary(mainWindow))
    }

    // Emitted when the window is closed.
    mainWindow.on('closed', () => {
        // Dereference the window object, usually you would store windows
        // in an array if your app supports multi windows, this is the time
        // when you should delete the corresponding element.
        mainWindow = null
    })
})
开发者ID:m0g,项目名称:ansel,代码行数:54,代码来源:entry.ts

示例2:

 socket.on('screen-getCursorScreenPoint', () => {
     var point = screen.getCursorScreenPoint();
     socket.emit('screen-getCursorScreenPointCompleted', point);
 });
开发者ID:E024,项目名称:Electron.NET,代码行数:4,代码来源:screen.ts


注:本文中的electron.screen.getCursorScreenPoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。