aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorlinux-man <linux-man@hotmail.com>2017-05-21 19:13:41 +0100
committerlinux-man <linux-man@hotmail.com>2017-05-21 19:13:41 +0100
commit9c3a65744ccd45a0e1673b5a1ead6842b6b64f2e (patch)
tree84b458c99c55cef63166f72f6c42565f3723d4b5 /plugin
parente3a3d3aa0aa1806e20bffb0ff4c307ec6cc89964 (diff)
downloadfosdem-2018-presentation-9c3a65744ccd45a0e1673b5a1ead6842b6b64f2e.tar
fosdem-2018-presentation-9c3a65744ccd45a0e1673b5a1ead6842b6b64f2e.tar.gz
Modified Zoom
Block dimension calculation is not accurate, so zoom is made on mouse coordinates Change default modifier to ctrl - alt don't work on Linux New parameter zoomLevel: default 2
Diffstat (limited to 'plugin')
-rw-r--r--plugin/zoom-js/zoom.js29
1 files changed, 6 insertions, 23 deletions
diff --git a/plugin/zoom-js/zoom.js b/plugin/zoom-js/zoom.js
index 8738083..41fd15d 100644
--- a/plugin/zoom-js/zoom.js
+++ b/plugin/zoom-js/zoom.js
@@ -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';//cl
+ 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),//cl
+ y: event.clientY - window.innerHeight / (zoomLevel * 2),
+ width: window.innerWidth / zoomLevel,
+ height: window.innerHeight / zoomLevel,
pan: false
});
}
@@ -283,6 +269,3 @@ var zoom = (function(){
}
})();
-
-
-