This commit is contained in:
Hakim El Hattab 2017-06-19 09:36:25 +02:00
commit 7d0d3c24ca
3 changed files with 28 additions and 43 deletions

View File

@ -398,6 +398,7 @@ Reveal.addEventListener( 'customevent', function() {
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/search/search.js', async: true },
{ src: 'plugin/zoom-js/zoom.js', async: true },
{ src: 'plugin/notes/notes.js', async: true }
]

File diff suppressed because one or more lines are too long

View File

@ -3,31 +3,17 @@
var isEnabled = true;
document.querySelector( '.reveal .slides' ).addEventListener( 'mousedown', function( event ) {
var modifier = ( Reveal.getConfig().zoomKey ? Reveal.getConfig().zoomKey : 'alt' ) + 'Key';
var zoomPadding = 20;
var revealScale = Reveal.getScale();
var modifier = ( Reveal.getConfig().zoomKey ? Reveal.getConfig().zoomKey : 'ctrl' ) + 'Key';
var zoomLevel = ( Reveal.getConfig().zoomLevel ? Reveal.getConfig().zoomLevel : 2 );
if( event[ modifier ] && isEnabled ) {
event.preventDefault();
var bounds;
var originalDisplay = event.target.style.display;
// Get the bounding rect of the contents, not the containing box
if( window.getComputedStyle( event.target ).display === 'block' ) {
event.target.style.display = 'inline-block';
bounds = event.target.getBoundingClientRect();
event.target.style.display = originalDisplay;
} else {
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 ),
x: event.clientX - window.innerWidth / (zoomLevel * 2),
y: event.clientY - window.innerHeight / (zoomLevel * 2),
width: window.innerWidth / zoomLevel,
height: window.innerHeight / zoomLevel,
pan: false
});
}
@ -283,6 +269,3 @@ var zoom = (function(){
}
})();