Fixed multiple text y positioning

This commit is contained in:
2018-04-23 22:07:56 -05:00
parent fb1f4370eb
commit e2af0958bb

View File

@@ -5,7 +5,6 @@ class MultiLineText
@texts = [] @texts = []
text.split("\n").each_with_index do |line, i| text.split("\n").each_with_index do |line, i|
_options = options _options = options
_options[:y]+=_options[:size]
@texts << Text.new(line, _options) @texts << Text.new(line, _options)
end end
@options = options @options = options
@@ -46,12 +45,13 @@ class MultiLineText
def y=(int) def y=(int)
@y = int @y = int
puts "Hi, #{int}"
@texts.each_with_index {|t, i| t.y=int+(i*t.size)} @texts.each_with_index {|t, i| t.y=int+(i*t.size)}
end end
def calculate_stack def calculate_stack
@texts.each_with_index do |text, index| @texts.each_with_index do |text, index|
text.y = text.size*index text.y = (text.size*index)+@options[:y]
end end
end end