Sha256: c7cb262d72d51835493cc5077523c059e264137b1a90788d4470b527a7ea53b6

Contents?: true

Size: 856 Bytes

Versions: 7

Compression:

Stored size: 856 Bytes

Contents

# frozen_string_literal: true

require_relative 'section_height'
require_relative 'draw_item'

module Thinreports
  module SectionReport
    module Renderer
      class StackViewRowRenderer
        include SectionHeight
        include DrawItem

        def initialize(pdf)
          @pdf = pdf
        end

        def render(row)
          doc = pdf.pdf

          actual_height = section_height(row)
          doc.bounding_box([0, doc.cursor], width: doc.bounds.width, height: actual_height) do
            row.items.each do |item|
              draw_item(item, (actual_height - row.schema.height))
            end
          end
        end

        private

        attr_reader :pdf

        def stack_view_renderer
          raise Thinreports::Errors::InvalidLayoutFormat, 'nested StackView does not supported'
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
thinreports-0.14.2 lib/thinreports/section_report/pdf/renderer/stack_view_row_renderer.rb
thinreports-0.14.1 lib/thinreports/section_report/pdf/renderer/stack_view_row_renderer.rb
thinreports-0.14.0 lib/thinreports/section_report/pdf/renderer/stack_view_row_renderer.rb
thinreports-0.13.1 lib/thinreports/section_report/pdf/renderer/stack_view_row_renderer.rb
thinreports-0.13.0 lib/thinreports/section_report/pdf/renderer/stack_view_row_renderer.rb
thinreports-0.12.1 lib/thinreports/section_report/pdf/renderer/stack_view_row_renderer.rb
thinreports-0.12.0 lib/thinreports/section_report/pdf/renderer/stack_view_row_renderer.rb