zoom.js works on main wrapper element

This commit is contained in:
Hakim El Hattab 2017-06-19 11:06:58 +02:00
parent 76eea30083
commit b04489b129

View File

@ -1,22 +1,27 @@
// Custom reveal.js integration // Custom reveal.js integration
(function(){ (function(){
document.querySelector( '.reveal .slides' ).addEventListener( 'mousedown', function( event ) { var revealElement = document.querySelector( '.reveal' );
var defaultModifier = /Linux/.test( window.navigator.platform ) ? 'ctrl' : 'alt'; if( revealElement ) {
var modifier = ( Reveal.getConfig().zoomKey ? Reveal.getConfig().zoomKey : defaultModifier ) + 'Key'; revealElement.addEventListener( 'mousedown', function( event ) {
var zoomLevel = ( Reveal.getConfig().zoomLevel ? Reveal.getConfig().zoomLevel : 2 ); var defaultModifier = /Linux/.test( window.navigator.platform ) ? 'ctrl' : 'alt';
if( event[ modifier ] && !Reveal.isOverview() ) { var modifier = ( Reveal.getConfig().zoomKey ? Reveal.getConfig().zoomKey : defaultModifier ) + 'Key';
event.preventDefault(); var zoomLevel = ( Reveal.getConfig().zoomLevel ? Reveal.getConfig().zoomLevel : 2 );
zoom.to({ if( event[ modifier ] && !Reveal.isOverview() ) {
x: event.clientX, event.preventDefault();
y: event.clientY,
scale: zoomLevel, zoom.to({
pan: false x: event.clientX,
}); y: event.clientY,
} scale: zoomLevel,
} ); pan: false
});
}
} );
}
})(); })();
/*! /*!