Sha256: 1fef77ab7a244ffe2b84ef8d19452aeac43893b3acf84d88478bef388f8f021b

Contents?: true

Size: 1.28 KB

Versions: 24

Compression:

Stored size: 1.28 KB

Contents

name = "slide-logo"

if @slide_logo_image.nil?
  theme_exit(_("must specify %s!!!") % "@slide_logo_image")
end

@slide_logo_position ||= :right
@slide_logo_width ||= nil
@slide_logo_height ||= canvas.height * 0.1

match(SlideElement) do
  delete_pre_draw_proc_by_name(name)

  break if @slide_logo_image_uninstall

  loader = ImageLoader.new(find_file(@slide_logo_image))

  add_pre_draw_proc(name) do |slide, canvas, x, y, w, h, simulation|
    unless simulation
      slide_logo_width = @slide_logo_width
      slide_logo_height = @slide_logo_height
      if slide_logo_width.respond_to?(:call)
        slide_logo_width = slide_logo_width.call(slide, canvas)
      end
      if slide_logo_height.respond_to?(:call)
        slide_logo_height = slide_logo_height.call(slide, canvas)
      end
      loader.resize(slide_logo_width, slide_logo_height)

      case @slide_logo_position
      when :right
        logo_x = canvas.width - loader.width
        logo_y = 0
      when :left
        logo_x = 0
        logo_y = 0
      else
        if @slide_logo_position.respond_to?(:call)
          logo_x, logo_y = @slide_logo_position.call(slide, canvas)
        else
          logo_x, logo_y = @slide_logo_position
        end
      end
      loader.draw(canvas, logo_x, logo_y)
    end
    [x, y, w, h]
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
rabbit-2.1.1 lib/rabbit/theme/slide-logo/slide-logo.rb
rabbit-2.1.0 lib/rabbit/theme/slide-logo/slide-logo.rb
rabbit-2.0.9 lib/rabbit/theme/slide-logo/slide-logo.rb
rabbit-2.0.8 lib/rabbit/theme/slide-logo/slide-logo.rb
rabbit-2.0.7 lib/rabbit/theme/slide-logo/slide-logo.rb
rabbit-2.0.6 lib/rabbit/theme/slide-logo/slide-logo.rb
rabbit-2.0.5 lib/rabbit/theme/slide-logo/slide-logo.rb
rabbit-2.0.4 lib/rabbit/theme/slide-logo/slide-logo.rb
rabbit-2.0.3 lib/rabbit/theme/slide-logo/slide-logo.rb
rabbit-2.0.2 lib/rabbit/theme/slide-logo/slide-logo.rb
rabbit-2.0.1 lib/rabbit/theme/slide-logo/slide-logo.rb
rabbit-2.0.0 lib/rabbit/theme/slide-logo/slide-logo.rb
rabbit-1.0.9 lib/rabbit/theme/slide-logo/slide-logo.rb
rabbit-1.0.8 lib/rabbit/theme/slide-logo/slide-logo.rb
rabbit-1.0.7 lib/rabbit/theme/slide-logo/slide-logo.rb
rabbit-1.0.6 lib/rabbit/theme/slide-logo/slide-logo.rb
rabbit-1.0.5 lib/rabbit/theme/slide-logo/slide-logo.rb
rabbit-1.0.4 lib/rabbit/theme/slide-logo/slide-logo.rb
rabbit-1.0.3 lib/rabbit/theme/slide-logo/slide-logo.rb
rabbit-1.0.2 lib/rabbit/theme/slide-logo/slide-logo.rb