zoom plugin now works for scaled presentations
This commit is contained in:
parent
dc215a2441
commit
8524af73f6
1 changed files with 13 additions and 1 deletions
|
@ -5,9 +5,21 @@
|
||||||
document.querySelector( '.reveal' ).addEventListener( 'mousedown', function( event ) {
|
document.querySelector( '.reveal' ).addEventListener( 'mousedown', function( event ) {
|
||||||
var modifier = ( Reveal.getConfig().zoomKey ? Reveal.getConfig().zoomKey : 'alt' ) + 'Key';
|
var modifier = ( Reveal.getConfig().zoomKey ? Reveal.getConfig().zoomKey : 'alt' ) + 'Key';
|
||||||
|
|
||||||
|
var zoomPadding = 20;
|
||||||
|
var revealScale = Reveal.getScale();
|
||||||
|
|
||||||
if( event[ modifier ] && isEnabled ) {
|
if( event[ modifier ] && isEnabled ) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
zoom.to({ element: event.target, pan: false });
|
|
||||||
|
var bounds = event.target.getBoundingClientRect();
|
||||||
|
|
||||||
|
zoom.to({
|
||||||
|
x: ( bounds.left * revealScale ) - zoomPadding,
|
||||||
|
y: ( bounds.top * revealScale ) - zoomPadding,
|
||||||
|
width: ( bounds.width * revealScale ) + ( zoomPadding * 2 ),
|
||||||
|
height: ( bounds.height * revealScale ) + ( zoomPadding * 2 ),
|
||||||
|
pan: false
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue