Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
JUNCA24 RevealJS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PGI15-Teaching
JUNCA24 RevealJS
Commits
080fb3cd
Commit
080fb3cd
authored
12 years ago
by
Hakim El Hattab
Browse files
Options
Downloads
Patches
Plain Diff
disable zoom plugin while in overview mode
parent
c21e6bbf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugin/zoom-js/zoom.js
+26
-21
26 additions, 21 deletions
plugin/zoom-js/zoom.js
with
26 additions
and
21 deletions
plugin/zoom-js/zoom.js
+
26
−
21
View file @
080fb3cd
// Custom reveal.js integration
(
function
(){
document
.
querySelector
(
'
.reveal
'
).
addEventListener
(
'
click
'
,
function
(
event
)
{
if
(
event
.
altKey
)
{
var
isEnabled
=
true
;
document
.
querySelector
(
'
.reveal
'
).
addEventListener
(
'
mousedown
'
,
function
(
event
)
{
if
(
event
.
altKey
&&
isEnabled
)
{
event
.
preventDefault
();
zoom
.
to
({
element
:
event
.
target
,
pan
:
false
});
}
}
);
Reveal
.
addEventListener
(
'
overviewshown
'
,
function
()
{
isEnabled
=
false
;
}
);
Reveal
.
addEventListener
(
'
overviewhidden
'
,
function
()
{
isEnabled
=
true
;
}
);
})();
/*!
* zoom.js 0.2 (modified version for use with reveal.js)
* http://lab.hakim.se/zoom-js
* MIT licensed
*
*
* Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
*/
var
zoom
=
(
function
(){
// The current zoom level (scale)
var
level
=
1
;
// The current mouse position, used for panning
var
mouseX
=
0
,
mouseY
=
0
;
// Timeout before pan is activated
var
panEngageTimeout
=
-
1
,
panUpdateInterval
=
-
1
;
...
...
@@ -36,7 +41,7 @@ var zoom = (function(){
'
msTransform
'
in
document
.
body
.
style
||
'
OTransform
'
in
document
.
body
.
style
||
'
transform
'
in
document
.
body
.
style
;
if
(
supportsTransforms
)
{
// The easing that will be applied when we zoom in/out
document
.
body
.
style
.
transition
=
'
transform 0.8s ease
'
;
...
...
@@ -45,7 +50,7 @@ var zoom = (function(){
document
.
body
.
style
.
MozTransition
=
'
-moz-transform 0.8s ease
'
;
document
.
body
.
style
.
WebkitTransition
=
'
-webkit-transform 0.8s ease
'
;
}
// Zoom out if the user hits escape
document
.
addEventListener
(
'
keyup
'
,
function
(
event
)
{
if
(
level
!==
1
&&
event
.
keyCode
===
27
)
{
...
...
@@ -62,21 +67,21 @@ var zoom = (function(){
},
false
);
/**
* Applies the CSS required to zoom in, prioritizes use of CSS3
* Applies the CSS required to zoom in, prioritizes use of CSS3
* transforms but falls back on zoom for IE.
*
* @param {Number} pageOffsetX
* @param {Number} pageOffsetY
* @param {Number} elementOffsetX
* @param {Number} elementOffsetY
* @param {Number} scale
*
* @param {Number} pageOffsetX
* @param {Number} pageOffsetY
* @param {Number} elementOffsetX
* @param {Number} elementOffsetY
* @param {Number} scale
*/
function
magnify
(
pageOffsetX
,
pageOffsetY
,
elementOffsetX
,
elementOffsetY
,
scale
)
{
if
(
supportsTransforms
)
{
var
origin
=
pageOffsetX
+
'
px
'
+
pageOffsetY
+
'
px
'
,
transform
=
'
translate(
'
+
-
elementOffsetX
+
'
px,
'
+
-
elementOffsetY
+
'
px) scale(
'
+
scale
+
'
)
'
;
document
.
body
.
style
.
transformOrigin
=
origin
;
document
.
body
.
style
.
OTransformOrigin
=
origin
;
document
.
body
.
style
.
msTransformOrigin
=
origin
;
...
...
@@ -121,7 +126,7 @@ var zoom = (function(){
}
/**
* Pan the document when the mosue cursor approaches the edges
* Pan the document when the mosue cursor approaches the edges
* of the window.
*/
function
pan
()
{
...
...
@@ -129,7 +134,7 @@ var zoom = (function(){
rangeX
=
window
.
innerWidth
*
range
,
rangeY
=
window
.
innerHeight
*
range
,
scrollOffset
=
getScrollOffset
();
// Up
if
(
mouseY
<
rangeY
)
{
window
.
scroll
(
scrollOffset
.
x
,
scrollOffset
.
y
-
(
1
-
(
mouseY
/
rangeY
)
)
*
(
14
/
level
)
);
...
...
@@ -159,7 +164,7 @@ var zoom = (function(){
return
{
/**
* Zooms in on either a rectangle or HTML element.
*
*
* @param {Object} options
* - element: HTML element to zoom in on
* OR
...
...
@@ -232,7 +237,7 @@ var zoom = (function(){
if
(
currentOptions
&&
currentOptions
.
element
)
{
scrollOffset
.
x
-=
(
window
.
innerWidth
-
(
currentOptions
.
width
*
currentOptions
.
scale
)
)
/
2
;
}
magnify
(
scrollOffset
.
x
,
scrollOffset
.
y
,
0
,
0
,
1
);
level
=
1
;
...
...
@@ -241,11 +246,11 @@ var zoom = (function(){
// Alias
magnify
:
function
(
options
)
{
this
.
to
(
options
)
},
reset
:
function
()
{
this
.
out
()
},
zoomLevel
:
function
()
{
return
level
;
}
}
})();
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment