From 692569f6551aab49d5b0af85646ea36e32810f02 Mon Sep 17 00:00:00 2001 From: Matt Lott Date: Sat, 22 Nov 2014 22:48:00 -0800 Subject: [PATCH] Update problem alert width to be more dynamic --- app/views/play/level/tome/ProblemAlertView.coffee | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/views/play/level/tome/ProblemAlertView.coffee b/app/views/play/level/tome/ProblemAlertView.coffee index a94987bf7..3c268e1b2 100644 --- a/app/views/play/level/tome/ProblemAlertView.coffee +++ b/app/views/play/level/tome/ProblemAlertView.coffee @@ -88,8 +88,12 @@ module.exports = class ProblemAlertView extends CocoView onWindowResize: (e) => # TODO: This all seems a little hacky if @problem? - @$el.css('left', $('#goals-view').outerWidth(true) + 'px') - @$el.css('right', $('#code-area').outerWidth(true) + 'px') + levelContentWidth = $('.level-content').outerWidth(true) + 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 # TODO: calculate this in a more dynamic, less sketchy way