Class: Browser::Screen

Inherits:
Object show all
Includes:
Event::Target, Native
Defined in:
opal/browser/screen.rb

Overview

Representation of the screen the window is being rendered on.

Defined Under Namespace

Classes: Depth

Instance Attribute Summary collapse

Method Summary

Methods included from Event::Target

#off, #on, #on!, #trigger, #trigger!

Instance Attribute Details

#depth ⇒ Depth (readonly)

Returns the screen depth.

Returns:

  • (Depth) —

    the screen depth



49
50
51
# File 'opal/browser/screen.rb', line 49

def depth
  Depth.new(`#@native.colorDepth`, `#@native.pixelDepth`)
end

#height ⇒ Integer (readonly)

Returns the height of the screen in pixels.

Returns:

  • (Integer) —

    the height of the screen in pixels



22
# File 'opal/browser/screen.rb', line 22

alias_native :height

#orientation ⇒ String (readonly)

Returns the orientation of the screen.

Returns:

  • (String) —

    the orientation of the screen



55
# File 'opal/browser/screen.rb', line 55

alias_native :orientation

#position ⇒ Position (readonly)

Returns the offset from the top left corner of the screen in pixels.

Returns:

  • (Position) —

    the offset from the top left corner of the screen in pixels



43
44
45
# File 'opal/browser/screen.rb', line 43

def position
  Position.new(x, y)
end

#size ⇒ Size (readonly)

Returns the size in pixels.

Returns:

  • (Size) —

    the size in pixels



26
27
28
# File 'opal/browser/screen.rb', line 26

def size
  Size.new(width, height)
end

#width ⇒ Integer (readonly)

Returns the width of the screen in pixels.

Returns:

  • (Integer) —

    the width of the screen in pixels



18
# File 'opal/browser/screen.rb', line 18

alias_native :width

#x ⇒ Integer (readonly)

Returns the offset from the top left corner of the screen in pixels.

Returns:

  • (Integer) —

    the offset from the top left corner of the screen in pixels



33
# File 'opal/browser/screen.rb', line 33

alias_native :x, :top

#y ⇒ Integer (readonly)

Returns the offset from the top left corner of the screen in pixels.

Returns:

  • (Integer) —

    the offset from the top left corner of the screen in pixels



38
# File 'opal/browser/screen.rb', line 38

alias_native :y, :left