electron#Point TypeScript Examples

The following examples show how to use electron#Point. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: price-check.ts    From awakened-poe-trade with MIT License 6 votes vote down vote up
export function showWidget (opts: {
  clipboard: string
  pressPosition: Point
  eventName: string
}) {
  checkPressPosition = (process.platform === 'win32')
    ? screen.dipToScreenPoint(opts.pressPosition)
    : opts.pressPosition
  const isLokedMode = (opts.eventName === 'price-check-locked')

  overlaySendEvent({
    name: 'MAIN->OVERLAY::price-check',
    payload: { clipboard: opts.clipboard, position: opts.pressPosition, lockedMode: isLokedMode }
  })

  const poeBounds = PoeWindow.bounds
  activeAreaRect = {
    x: getOffsetX(checkPressPosition, poeBounds),
    y: poeBounds.y,
    width: Math.floor(WIDTH_96DPI * DPR * config.get('fontSize')),
    height: poeBounds.height
  }

  isPriceCheckShown = true
  isClickedAfterLock = false
  isMouseInside = false

  if (isLokedMode) {
    lockWindow(true)
  }
}
Example #2
Source File: price-check.ts    From awakened-poe-trade with MIT License 6 votes vote down vote up
function getOffsetX (mousePos: Point, poePos: Rectangle): number {
  if (mousePos.x > (poePos.x + poePos.width / 2)) {
    // inventory
    return (poePos.x + poePos.width) - PoeWindow.uiSidebarWidth - Math.floor(WIDTH_96DPI * DPR * config.get('fontSize'))
  } else {
    // stash or chat
    return poePos.x + PoeWindow.uiSidebarWidth
  }
}
Example #3
Source File: price-check.ts    From awakened-poe-trade with MIT License 5 votes vote down vote up
function isPointInsideRect (point: Point, rect: Rectangle) {
  return (
    point.x > rect.x &&
    point.x < rect.x + rect.width &&
    point.y > rect.y &&
    point.y < rect.y + rect.height
  )
}
Example #4
Source File: price-check.ts    From awakened-poe-trade with MIT License 5 votes vote down vote up
checkPressPosition: Point | undefined