correction to view distance calculation for vertical slides
This commit is contained in:
parent
a96ace5194
commit
cc41aa9115
22
js/reveal.js
22
js/reveal.js
@ -1587,13 +1587,14 @@ var Reveal = (function(){
|
|||||||
// an array
|
// an array
|
||||||
var horizontalSlides = toArray( document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ),
|
var horizontalSlides = toArray( document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) ),
|
||||||
horizontalSlidesLength = horizontalSlides.length,
|
horizontalSlidesLength = horizontalSlides.length,
|
||||||
distance;
|
distanceX,
|
||||||
|
distanceY;
|
||||||
|
|
||||||
if( horizontalSlidesLength ) {
|
if( horizontalSlidesLength ) {
|
||||||
|
|
||||||
// The number of steps away from the present slide that will
|
// The number of steps away from the present slide that will
|
||||||
// be visible
|
// be visible
|
||||||
var viewDistance = isOverview() ? 20 : config.viewDistance;
|
var viewDistance = isOverview() ? 10 : config.viewDistance;
|
||||||
|
|
||||||
// Limit view distance on weaker devices
|
// Limit view distance on weaker devices
|
||||||
if( isMobileDevice ) {
|
if( isMobileDevice ) {
|
||||||
@ -1606,30 +1607,29 @@ var Reveal = (function(){
|
|||||||
var verticalSlides = toArray( horizontalSlide.querySelectorAll( 'section' ) ),
|
var verticalSlides = toArray( horizontalSlide.querySelectorAll( 'section' ) ),
|
||||||
verticalSlidesLength = verticalSlides.length;
|
verticalSlidesLength = verticalSlides.length;
|
||||||
|
|
||||||
|
// Loops so that it measures 1 between the first and last slides
|
||||||
|
distanceX = Math.abs( ( indexh - x ) % ( horizontalSlidesLength - viewDistance ) ) || 0;
|
||||||
|
|
||||||
if( verticalSlidesLength ) {
|
if( verticalSlidesLength ) {
|
||||||
|
|
||||||
// Always show the vertical stack itself, even if its child
|
// Always show the vertical stack itself, even if its child
|
||||||
// slides are invisible
|
// slides are invisible
|
||||||
horizontalSlide.style.display = 'block';
|
horizontalSlide.style.display = 'block';
|
||||||
|
|
||||||
|
var oy = getPreviousVerticalIndex( horizontalSlide );
|
||||||
|
|
||||||
for( var y = 0; y < verticalSlidesLength; y++ ) {
|
for( var y = 0; y < verticalSlidesLength; y++ ) {
|
||||||
var verticalSlide = verticalSlides[y];
|
var verticalSlide = verticalSlides[y];
|
||||||
|
|
||||||
var dx = x - indexh,
|
distanceY = x === indexh ? Math.abs( indexv - y ) : Math.abs( y - oy );
|
||||||
dy = y - indexv;
|
|
||||||
|
|
||||||
distance = Math.sqrt( dx*dx + dy*dy );
|
verticalSlide.style.display = ( distanceX + distanceY ) > viewDistance ? 'none' : 'block';
|
||||||
|
|
||||||
verticalSlide.style.display = distance > viewDistance ? 'none' : 'block';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
// Loops so that it measures 1 between the first and last slides
|
horizontalSlide.style.display = distanceX > viewDistance ? 'none' : 'block';
|
||||||
distance = Math.abs( ( indexh - x ) % ( horizontalSlidesLength - viewDistance ) ) || 0;
|
|
||||||
|
|
||||||
horizontalSlide.style.display = distance > viewDistance ? 'none' : 'block';
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
4
js/reveal.min.js
vendored
4
js/reveal.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user