Update problem alert width to be more dynamic

This commit is contained in:
Matt Lott 2014-11-22 22:48:00 -08:00
parent b7949424e6
commit 692569f655

View file

@ -88,8 +88,12 @@ module.exports = class ProblemAlertView extends CocoView
onWindowResize: (e) => onWindowResize: (e) =>
# TODO: This all seems a little hacky # TODO: This all seems a little hacky
if @problem? if @problem?
@$el.css('left', $('#goals-view').outerWidth(true) + 'px') levelContentWidth = $('.level-content').outerWidth(true)
@$el.css('right', $('#code-area').outerWidth(true) + 'px') goalsViewWidth = $('#goals-view').outerWidth(true)
codeAreaWidth = $('#code-area').outerWidth(true)
# problem alert view has 20px padding
@$el.css('max-width', levelContentWidth - codeAreaWidth - goalsViewWidth + 40 + 'px')
@$el.css('right', codeAreaWidth + 'px')
# 110px from top roughly aligns top of alert with top of first code line # 110px from top roughly aligns top of alert with top of first code line
# TODO: calculate this in a more dynamic, less sketchy way # TODO: calculate this in a more dynamic, less sketchy way