Skip to content

Commit

Permalink
prefer transform scaling over zoom on hdpi displays
Browse files Browse the repository at this point in the history
  • Loading branch information
hakimel committed Apr 2, 2019
1 parent 15dec96 commit 4c557a5
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions js/reveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -2243,18 +2243,23 @@
transformSlides( { layout: '' } );
}
else {
// Prefer zoom for scaling up so that content remains crisp.
// Don't use zoom to scale down since that can lead to shifts
// in text layout/line breaks.
if( scale > 1 && features.zoom ) {
// Zoom Scaling
// Content remains crisp no matter how much we scale. Side
// effects are minor differences in text layout and iframe
// viewports changing size. A 200x200 iframe viewport in a
// 2x zoomed presentation ends up having a 400x400 viewport.
if( scale > 1 && features.zoom && window.devicePixelRatio < 2 ) {
dom.slides.style.zoom = scale;
dom.slides.style.left = '';
dom.slides.style.top = '';
dom.slides.style.bottom = '';
dom.slides.style.right = '';
transformSlides( { layout: '' } );
}
// Apply scale transform as a fallback
// Transform Scaling
// Content layout remains the exact same when scaled up.
// Side effect is content becoming blurred, especially with
// high scale values on ldpi screens.
else {
dom.slides.style.zoom = '';
dom.slides.style.left = '50%';
Expand Down

0 comments on commit 4c557a5

Please sign in to comment.