minor simplicifcation for #2579

This commit is contained in:
Hakim El Hattab 2020-02-06 15:19:09 +01:00
parent be08d52b5b
commit e9cbfefcce
1 changed files with 13 additions and 22 deletions

View File

@ -343,9 +343,8 @@
previousBackground, previousBackground,
// Remember which directions that the user has navigated towards // Remember which directions that the user has navigated towards
hasNavigatedRight = false, hasNavigatedHorizontally = false,
hasNavigatedLeft = false, hasNavigatedVertically = false,
hasNavigatedDown = false,
// Slides may hold a data-state attribute which we pick up and apply // Slides may hold a data-state attribute which we pick up and apply
// as a class to the body. This list contains the combined state of // as a class to the body. This list contains the combined state of
@ -771,12 +770,9 @@
dom.progressbar = dom.progress.querySelector( 'span' ); dom.progressbar = dom.progress.querySelector( 'span' );
// Arrow controls // Arrow controls
var leftArrowLabel = config.rtl ? "next slide" : "previous slide";
var rightArrowLabel = config.rtl ? "previous slide" : "next slide";
dom.controls = createSingletonNode( dom.wrapper, 'aside', 'controls', dom.controls = createSingletonNode( dom.wrapper, 'aside', 'controls',
'<button class="navigate-left" aria-label="' + leftArrowLabel + '"><div class="controls-arrow"></div></button>' + '<button class="navigate-left" aria-label="' + ( config.rtl ? 'next slide' : 'previous slide' ) + '"><div class="controls-arrow"></div></button>' +
'<button class="navigate-right" aria-label="' + rightArrowLabel + '"><div class="controls-arrow"></div></button>' + '<button class="navigate-right" aria-label="' + ( config.rtl ? 'previous slide' : 'next slide' ) + '"><div class="controls-arrow"></div></button>' +
'<button class="navigate-up" aria-label="above slide"><div class="controls-arrow"></div></button>' + '<button class="navigate-up" aria-label="above slide"><div class="controls-arrow"></div></button>' +
'<button class="navigate-down" aria-label="below slide"><div class="controls-arrow"></div></button>' ); '<button class="navigate-down" aria-label="below slide"><div class="controls-arrow"></div></button>' );
@ -3633,7 +3629,7 @@
// Highlight control arrows with an animation to ensure // Highlight control arrows with an animation to ensure
// that the viewer knows how to navigate // that the viewer knows how to navigate
if( !hasNavigatedDown && routes.down ) { if( !hasNavigatedVertically && routes.down ) {
dom.controlsDownArrow.classList.add( 'highlight' ); dom.controlsDownArrow.classList.add( 'highlight' );
} }
else { else {
@ -3641,7 +3637,7 @@
if( config.rtl ) { if( config.rtl ) {
if( !hasNavigatedLeft && routes.left && indexv === 0 ) { if( !hasNavigatedHorizontally && routes.left && indexv === 0 ) {
dom.controlsLeftArrow.classList.add( 'highlight' ); dom.controlsLeftArrow.classList.add( 'highlight' );
} }
else { else {
@ -3650,7 +3646,7 @@
} else { } else {
if( !hasNavigatedRight && routes.right && indexv === 0 ) { if( !hasNavigatedHorizontally && routes.right && indexv === 0 ) {
dom.controlsRightArrow.classList.add( 'highlight' ); dom.controlsRightArrow.classList.add( 'highlight' );
} }
else { else {
@ -5369,7 +5365,7 @@
function navigateLeft() { function navigateLeft() {
hasNavigatedLeft = true; hasNavigatedHorizontally = true;
// Reverse for RTL // Reverse for RTL
if( config.rtl ) { if( config.rtl ) {
@ -5386,7 +5382,7 @@
function navigateRight() { function navigateRight() {
hasNavigatedRight = true; hasNavigatedHorizontally = true;
// Reverse for RTL // Reverse for RTL
if( config.rtl ) { if( config.rtl ) {
@ -5412,7 +5408,7 @@
function navigateDown() { function navigateDown() {
hasNavigatedDown = true; hasNavigatedVertically = true;
// Prioritize revealing fragments // Prioritize revealing fragments
if( ( isOverview() || nextFragment() === false ) && availableRoutes().down ) { if( ( isOverview() || nextFragment() === false ) && availableRoutes().down ) {
@ -5460,13 +5456,8 @@
*/ */
function navigateNext() { function navigateNext() {
if (!config.rtl) { hasNavigatedHorizontally = true;
hasNavigatedRight = true; hasNavigatedVertically = true;
} else {
hasNavigatedLeft = true;
}
hasNavigatedDown = true;
// Prioritize revealing fragments // Prioritize revealing fragments
if( nextFragment() === false ) { if( nextFragment() === false ) {