fix auto-animate bug on centered slides
This commit is contained in:
parent
ab273a19f2
commit
3a032a836a
4 changed files with 22 additions and 16 deletions
2
dist/reveal.esm.js
vendored
2
dist/reveal.esm.js
vendored
File diff suppressed because one or more lines are too long
2
dist/reveal.js
vendored
2
dist/reveal.js
vendored
File diff suppressed because one or more lines are too long
|
@ -162,12 +162,13 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="../dist/reveal.es5.js"></script>
|
<script src="../dist/reveal.js"></script>
|
||||||
<script src="../dist/plugin/highlight.js"></script>
|
<script src="../dist/plugin/highlight.js"></script>
|
||||||
<script>
|
<script>
|
||||||
Reveal.initialize({
|
Reveal.initialize({
|
||||||
center: true,
|
center: true,
|
||||||
hash: true
|
hash: true,
|
||||||
|
plugins: [ RevealHighlight ]
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -331,6 +331,8 @@ export default class AutoAnimate {
|
||||||
*/
|
*/
|
||||||
getAutoAnimatableProperties( direction, element, elementOptions ) {
|
getAutoAnimatableProperties( direction, element, elementOptions ) {
|
||||||
|
|
||||||
|
let config = this.Reveal.getConfig();
|
||||||
|
|
||||||
let properties = { styles: [] };
|
let properties = { styles: [] };
|
||||||
|
|
||||||
// Position and size
|
// Position and size
|
||||||
|
@ -343,17 +345,20 @@ export default class AutoAnimate {
|
||||||
bounds = elementOptions.measure( element );
|
bounds = elementOptions.measure( element );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let scale = this.Reveal.getScale();
|
if( config.center ) {
|
||||||
bounds = {
|
// More precise, but breaks when used in combination
|
||||||
x: element.offsetLeft * scale,
|
// with zoom for scaling the deck ¯\_(ツ)_/¯
|
||||||
y: element.offsetTop * scale,
|
bounds = element.getBoundingClientRect();
|
||||||
width: element.offsetWidth * scale,
|
}
|
||||||
height: element.offsetHeight * scale
|
else {
|
||||||
};
|
let scale = this.Reveal.getScale();
|
||||||
|
bounds = {
|
||||||
// More precise, but breaks when used in combination
|
x: element.offsetLeft * scale,
|
||||||
// with zoom for scaling the deck ¯\_(ツ)_/¯
|
y: element.offsetTop * scale,
|
||||||
// bounds = element.getBoundingClientRect();
|
width: element.offsetWidth * scale,
|
||||||
|
height: element.offsetHeight * scale
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
properties.x = bounds.x;
|
properties.x = bounds.x;
|
||||||
|
@ -365,7 +370,7 @@ export default class AutoAnimate {
|
||||||
const computedStyles = getComputedStyle( element );
|
const computedStyles = getComputedStyle( element );
|
||||||
|
|
||||||
// CSS styles
|
// CSS styles
|
||||||
( elementOptions.styles || this.Reveal.getConfig().autoAnimateStyles ).forEach( style => {
|
( elementOptions.styles || config.autoAnimateStyles ).forEach( style => {
|
||||||
let value;
|
let value;
|
||||||
|
|
||||||
// `style` is either the property name directly, or an object
|
// `style` is either the property name directly, or an object
|
||||||
|
|
Loading…
Reference in a new issue