Fix cellHeight calculation

openid
Marcin Kulik 12 years ago
parent 6fcef6e448
commit b1567e75f2

@ -41,10 +41,16 @@ class AsciiIo.Renderer.Base extends Backbone.View
afterInsertedToDom: -> afterInsertedToDom: ->
sample = $('<span class="font-sample"><span class="line"><span>M</span></span></span>') sample = $('<span class="font-sample"><span class="line"><span>M</span></span></span>')
@$el.parent().append(sample)
@cellWidth = sample.width()
span = sample.find('span span') span = sample.find('span span')
@cellHeight = span.height() + span.css('padding-top') + span.css('padding-bottom')
@$el.parent().append sample
@cellWidth = sample.width()
@cellHeight = span.height() +
parseInt(span.css('padding-top')) +
parseInt(span.css('padding-bottom'))
sample.remove() sample.remove()
@fixTerminalElementSize() @fixTerminalElementSize()
@fixPlayerContainerSize() @fixPlayerContainerSize()

@ -38,6 +38,8 @@ class AsciiIo.Renderer.Canvas extends AsciiIo.Renderer.Base
for fragment in fragments for fragment in fragments
[text, brush] = fragment [text, brush] = fragment
brush = AsciiIo.Brush.create brush if brush
if cursorX isnt undefined and rendered <= cursorX < rendered + text.length if cursorX isnt undefined and rendered <= cursorX < rendered + text.length
@cursorBrush = brush @cursorBrush = brush
@cursorText = text[cursorX - rendered] @cursorText = text[cursorX - rendered]

Loading…
Cancel
Save