removed polling vs resizeviewer option from demo

This commit is contained in:
Tom 2022-12-14 11:31:12 -05:00
parent 67fc9eafe8
commit 564121428c

View File

@ -98,13 +98,6 @@
<p>These options apply to both of the demo viewers on the left (top and bottom).</p> <p>These options apply to both of the demo viewers on the left (top and bottom).</p>
<div class="options"> <div class="options">
<div class="method listener-method selected" data-value="0">
<pre>Use polling</pre>
</div>
<div class="method listener-method" data-value="1">
<pre>Use ResizeObserver</pre>
</div>
<div class="method preserve-method selected" data-value="0"> <div class="method preserve-method selected" data-value="0">
<pre>preserveImageSizeOnResize: false</pre> <pre>preserveImageSizeOnResize: false</pre>
</div> </div>
@ -169,22 +162,7 @@
function updateViewer(){ function updateViewer(){
viewer.preserveImageSizeOnResize = !!parseInt($('.preserve-method.selected').data('value')); viewer.preserveImageSizeOnResize = !!parseInt($('.preserve-method.selected').data('value'));
viewer.autoResize = !!parseInt($('.auto-method.selected').data('value')); viewer.autoResize = !!parseInt($('.auto-method.selected').data('value'));
var useResizeObserver=!!parseInt($('.listener-method.selected').data('value'));
if(useResizeObserver){
if(viewer._resizeObserver && viewer._autoResizePolling){
viewer._resizeObserver.observe(viewer.container);
viewer._autoResizePolling = false;
}
} else {
if(viewer._resizeObserver && !viewer._autoResizePolling){
viewer._resizeObserver.observe(viewer.container);
viewer._autoResizePolling = true;
}
}
} }
$('.preserve-method').on('click',function(){ $('.preserve-method').on('click',function(){
@ -197,15 +175,6 @@
$(this).addClass('selected'); $(this).addClass('selected');
}); });
if(!window.ResizeObserver){
$('.listener-method[data-value=1]').text('ResizeObserver not support in your browser').addClass('invalid');
}
$('.listener-method').on('click',function(){
$('.listener-method').removeClass('selected');
if(!$(this).hasClass('invalid')) $(this).addClass('selected');
})
$('.method').on('click',updateViewer); $('.method').on('click',updateViewer);
var container = $('.inner-container'); var container = $('.inner-container');