fix auto-animate bug on centered slides
parent
ab273a19f2
commit
3a032a836a
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -162,12 +162,13 @@
|
|||
|
||||
</div>
|
||||
|
||||
<script src="../dist/reveal.es5.js"></script>
|
||||
<script src="../dist/reveal.js"></script>
|
||||
<script src="../dist/plugin/highlight.js"></script>
|
||||
<script>
|
||||
Reveal.initialize({
|
||||
center: true,
|
||||
hash: true
|
||||
hash: true,
|
||||
plugins: [ RevealHighlight ]
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -331,6 +331,8 @@ export default class AutoAnimate {
|
|||
*/
|
||||
getAutoAnimatableProperties( direction, element, elementOptions ) {
|
||||
|
||||
let config = this.Reveal.getConfig();
|
||||
|
||||
let properties = { styles: [] };
|
||||
|
||||
// Position and size
|
||||
|
@ -342,6 +344,12 @@ export default class AutoAnimate {
|
|||
if( typeof elementOptions.measure === 'function' ) {
|
||||
bounds = elementOptions.measure( element );
|
||||
}
|
||||
else {
|
||||
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 = {
|
||||
|
@ -350,10 +358,7 @@ export default class AutoAnimate {
|
|||
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();
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue