bespokejs / bespoke-scale

Responsive Slide Scaling for Bespoke.js
MIT License
8 stars 7 forks source link

Refresh slide dimension settings after each resize #2

Open medikoo opened 10 years ago

medikoo commented 10 years ago

Currently bespoke-scale saves slide dimensions at initialization and refers to it through further process, it doesn't work well, if for some reason we changed slides size during the presentation.

I have such use case when using bespoke-notes plugin. It allows to optionally display notes aside of slide (then slide width becomes twice as long as initial one). Additionally it dispatches resize event to invoke any eventual resize related logic. Still bespoke-scale doesn't pick size change, and presentation needs to be brutally reloaded to adjust to new size.

Demo of this case: http://medikoo.com/asynchronous-javascript-interfaces/ (press n key to toggle notes).

This change fixes that.

coveralls commented 10 years ago

Coverage Status

Coverage remained the same when pulling 9b48e0b6d70e941e18fced22b010f962a9ec8fd2 on medikoo:reread-slide-size into 50f36a128589f90a3c42bf74c8fae4585a772bed on markdalgleish:master.

markdalgleish commented 10 years ago

This looks good. Could you squash this into a single commit?

medikoo commented 10 years ago

Done

coveralls commented 10 years ago

Coverage Status

Coverage remained the same when pulling fb44c7abe168a39f3753c121b5e370f48447a8c5 on medikoo:reread-slide-size into 50f36a128589f90a3c42bf74c8fae4585a772bed on markdalgleish:master.

mojavelinux commented 9 years ago

I don't think it's necessary to set the slideHeight and slideWidth variables in the main block anymore. In fact, even the firstSlide variable is probably better assigned in the scaleAll method.

I recommend moving this whole block into the scaleAll method.

var firstSlide = deck.slides[0],
  slideHeight = firstSlide.offsetHeight,
  slideWidth = firstSlide.offsetWidth;
coveralls commented 8 years ago

Coverage Status

Changes Unknown when pulling 12f3d8caa684299dd4e002bc9600f9fdbd0474bd on medikoo:reread-slide-size into \ on bespokejs:master**.

coveralls commented 8 years ago

Coverage Status

Changes Unknown when pulling 08a1103d4e8dcf59482c7ae0d6d32543e668188d on medikoo:reread-slide-size into \ on bespokejs:master**.