aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2020-05-08 20:33:28 +0200
committerHakim El Hattab <hakim.elhattab@gmail.com>2020-05-08 20:33:28 +0200
commit3a032a836a9a5f12ef3ccc4d94e976ee0bb22e51 (patch)
treefe07f1b1dd916fe01a8f7e70887228d3f0fc301a /js
parentab273a19f22c963e9ea33dca9d72d33fc03c6377 (diff)
downloadfosdem-2021-minimalism-presentation-3a032a836a9a5f12ef3ccc4d94e976ee0bb22e51.tar
fosdem-2021-minimalism-presentation-3a032a836a9a5f12ef3ccc4d94e976ee0bb22e51.tar.gz
fix auto-animate bug on centered slides
Diffstat (limited to 'js')
-rw-r--r--js/controllers/autoanimate.js29
1 files changed, 17 insertions, 12 deletions
diff --git a/js/controllers/autoanimate.js b/js/controllers/autoanimate.js
index a55b2a7..5395729 100644
--- a/js/controllers/autoanimate.js
+++ b/js/controllers/autoanimate.js
@@ -331,6 +331,8 @@ export default class AutoAnimate {
*/
getAutoAnimatableProperties( direction, element, elementOptions ) {
+ let config = this.Reveal.getConfig();
+
let properties = { styles: [] };
// Position and size
@@ -343,17 +345,20 @@ export default class AutoAnimate {
bounds = elementOptions.measure( element );
}
else {
- let scale = this.Reveal.getScale();
- bounds = {
- x: element.offsetLeft * scale,
- y: element.offsetTop * scale,
- width: element.offsetWidth * scale,
- height: element.offsetHeight * scale
- };
-
- // More precise, but breaks when used in combination
- // with zoom for scaling the deck ¯\_(ツ)_/¯
- // bounds = element.getBoundingClientRect();
+ if( config.center ) {
+ // More precise, but breaks when used in combination
+ // with zoom for scaling the deck ¯\_(ツ)_/¯
+ bounds = element.getBoundingClientRect();
+ }
+ else {
+ let scale = this.Reveal.getScale();
+ bounds = {
+ x: element.offsetLeft * scale,
+ y: element.offsetTop * scale,
+ width: element.offsetWidth * scale,
+ height: element.offsetHeight * scale
+ };
+ }
}
properties.x = bounds.x;
@@ -365,7 +370,7 @@ export default class AutoAnimate {
const computedStyles = getComputedStyle( element );
// CSS styles
- ( elementOptions.styles || this.Reveal.getConfig().autoAnimateStyles ).forEach( style => {
+ ( elementOptions.styles || config.autoAnimateStyles ).forEach( style => {
let value;
// `style` is either the property name directly, or an object