Skip to content

Commit

Permalink
Rely on firstSlide only in scaleAll
Browse files Browse the repository at this point in the history
  • Loading branch information
medikoo committed Oct 5, 2016
1 parent 12f3d8c commit 08a1103
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/bespoke-scale.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
module.exports = function(options) {
return function(deck) {
var parent = deck.parent,
firstSlide = deck.slides[0],
slideHeight = firstSlide.offsetHeight,
slideWidth = firstSlide.offsetWidth,
useZoom = options === 'zoom' || ('zoom' in parent.style && options !== 'transform'),

wrap = function(element) {
Expand Down Expand Up @@ -32,10 +29,9 @@ module.exports = function(options) {
},

scaleAll = function() {
slideHeight = firstSlide.offsetHeight;
slideWidth = firstSlide.offsetWidth;
var xScale = parent.offsetWidth / slideWidth,
yScale = parent.offsetHeight / slideHeight;
var firstSlide = deck.slides[0],
xScale = parent.offsetWidth / firstSlide.offsetWidth,
yScale = parent.offsetHeight / firstSlide.offsetHeight;

elements.forEach(scale.bind(null, Math.min(xScale, yScale)));
};
Expand Down

0 comments on commit 08a1103

Please sign in to comment.