class Castaway::Element::Pointer

Public Class Methods

new(production, scene, id) click to toggle source
Calls superclass method Castaway::Element::Still::new
# File lib/castaway/element/pointer.rb, line 9
def initialize(production, scene, id)
  path, options = production.pointers.fetch(id)
  super(production, scene, path)

  @box = Box.from_size(@size)
  @box[:hotspot] = Castaway::Point.make(options[:hotspot] || [0, 0])

  ideal_width = production.resolution.width * options[:scale]
  sx = ideal_width.to_f / @size.width

  scale(sx)
end

Public Instance Methods

hotspot() click to toggle source
# File lib/castaway/element/pointer.rb, line 22
def hotspot
  @box.
    scale(@scale || 0).
    rotate(@angle || 0).
    bounds[:hotspot]
end
position() click to toggle source
# File lib/castaway/element/pointer.rb, line 29
def position
  @position - hotspot
end