Sha256: 5e7527aef6736da409859011ed8c7d0b0c45d6b51ed7afd053fa123f8ae96afb
Contents?: true
Size: 1.54 KB
Versions: 6
Compression:
Stored size: 1.54 KB
Contents
module Browser # Representation of the screen the window is being rendered on. # # @see https://developer.mozilla.org/en-US/docs/Web/API/Window.screen class Screen include Browser::NativeCachedWrapper include Event::Target target {|value| Screen.new(value) if Native.is_a?(value, `window.Screen`) } Depth = Struct.new(:color, :pixel) # @!attribute [r] width # @return [Integer] the width of the screen in pixels alias_native :width # @!attribute [r] height # @return [Integer] the height of the screen in pixels alias_native :height # @!attribute [r] size # @return [Size] the size in pixels def size Size.new(width, height) end # @!attribute [r] x # @return [Integer] the offset from the top left corner of the screen in # pixels alias_native :x, :top # @!attribute [r] y # @return [Integer] the offset from the top left corner of the screen in # pixels alias_native :y, :left # @!attribute [r] position # @return [Position] the offset from the top left corner of the screen in # pixels def position Position.new(x, y) end # @!attribute [r] depth # @return [Depth] the screen depth def depth Depth.new(`#@native.colorDepth`, `#@native.pixelDepth`) end # @!attribute [r] orientation # @return [String] the orientation of the screen alias_native :orientation end class Window # @!attribute [r] screen # @return [Screen] the screen for the window def screen @screen ||= Screen.new(`#@native.screen`) end end end
Version data entries
6 entries across 6 versions & 2 rubygems