Method: Motion::Popup::Panel#toggleWithFrame

Defined in:
lib/motion/popup/panel.rb

#toggleWithFrame(frame) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/motion/popup/panel.rb', line 26

def toggleWithFrame(frame)
  if self.isVisible
    self.orderOut(false)
  else
    event_frame = frame
    window_frame = self.frame
    window_top_left_position = CGPointMake(event_frame.origin.x + (event_frame.size.width / 2) - (window_frame.size.width / 2), event_frame.origin.y)
    self.setFrameTopLeftPoint(window_top_left_position)

    self.background.setArrowX(window_frame.size.width / 2) if self.arrow

    NSApp.activateIgnoringOtherApps(true)
    self.makeKeyAndOrderFront(self)
  end
end