1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-05 15:32:55 +02:00

Prevent double expanding

This commit is contained in:
Fred Chasen 2015-06-22 17:10:14 -04:00
parent ba608b6233
commit da5006792f
3 changed files with 2029 additions and 1431 deletions

3441
dist/epub.js vendored

File diff suppressed because it is too large Load diff

6
dist/epub.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -132,9 +132,11 @@ EPUBJS.View.prototype.expand = function(force) {
var height = this.lockedHeight;
var textWidth, textHeight;
if(!this.iframe || this._expanding) return;
if(!this.iframe) return;
this._expanding = true;
// Expand Horizontally
if(height && !width) {
// Get the width of the text
@ -172,6 +174,7 @@ EPUBJS.View.prototype.expand = function(force) {
this.resize(width, height);
}
this._expanding = false;
};
EPUBJS.View.prototype.contentWidth = function(min) {
@ -401,7 +404,7 @@ EPUBJS.View.prototype.resizeListenters = function() {
EPUBJS.View.prototype.mediaQueryListeners = function() {
var sheets = this.document.styleSheets;
var mediaChangeHandler = function(m){
if(m.matches) {
if(m.matches && !this._expanding) {
this.expand();
}
}.bind(this);
@ -425,7 +428,9 @@ EPUBJS.View.prototype.observe = function(target) {
// create an observer instance
var observer = new MutationObserver(function(mutations) {
renderer.expand();
if(renderer._expanding) {
renderer.expand();
}
// mutations.forEach(function(mutation) {
// console.log(mutation);
// });