mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-24 14:01:33 +00:00
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
This commit is contained in:
parent
1acc924e0b
commit
50e03e93ba
1 changed files with 11 additions and 6 deletions
|
@ -249,15 +249,20 @@ define [
|
||||||
spinner.remove(element)
|
spinner.remove(element)
|
||||||
ctrl.redraw(origposition)
|
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', () ->
|
scope.$on 'layout-ready', () ->
|
||||||
# console.log 'GOT LAYOUT READY EVENT'
|
# console.log 'GOT LAYOUT READY EVENT'
|
||||||
# console.log 'calling refresh'
|
# 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()
|
updateContainer()
|
||||||
spinner.add(element)
|
spinner.add(element)
|
||||||
layoutReady.resolve 'layout is ready'
|
layoutReady.resolve 'layout is ready'
|
||||||
|
|
Loading…
Reference in a new issue