From 50e03e93ba45482a0f32b104654cb9f14e80f0f0 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Tue, 9 Dec 2014 14:40:54 +0000 Subject: [PATCH] poll the element for the pdf viewer if it is zero size avoid invisible pdf forever waiting for layout-ready event when switching between full-screen and split-screen --- .../ide/pdfng/directives/pdfViewer.coffee | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/services/web/public/coffee/ide/pdfng/directives/pdfViewer.coffee b/services/web/public/coffee/ide/pdfng/directives/pdfViewer.coffee index 977fea8fff..c9c696d087 100644 --- a/services/web/public/coffee/ide/pdfng/directives/pdfViewer.coffee +++ b/services/web/public/coffee/ide/pdfng/directives/pdfViewer.coffee @@ -249,15 +249,20 @@ define [ spinner.remove(element) ctrl.redraw(origposition) + checkElementReady = () -> + # if element is zero-sized keep checking until it is ready + if element.height() == 0 or element.width() == 0 + $timeout () -> + checkElementReady() + , 250 + else + scope.$broadcast 'layout-ready' if !scope.parentSize? + + checkElementReady() + scope.$on 'layout-ready', () -> # console.log 'GOT LAYOUT READY EVENT' # console.log 'calling refresh' - if element.height() == 0 or element.width() == 0 - # if element is zero-sized keep checking until it is ready - $timeout () -> - scope.$broadcast 'layout-ready' - , 250 - return updateContainer() spinner.add(element) layoutReady.resolve 'layout is ready'