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:
parent
ba608b6233
commit
da5006792f
3 changed files with 2029 additions and 1431 deletions
3047
dist/epub.js
vendored
3047
dist/epub.js
vendored
File diff suppressed because it is too large
Load diff
6
dist/epub.min.js
vendored
6
dist/epub.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -133,7 +133,9 @@ EPUBJS.View.prototype.expand = function(force) {
|
||||||
|
|
||||||
var textWidth, textHeight;
|
var textWidth, textHeight;
|
||||||
|
|
||||||
if(!this.iframe) return;
|
if(!this.iframe || this._expanding) return;
|
||||||
|
|
||||||
|
this._expanding = true;
|
||||||
|
|
||||||
// Expand Horizontally
|
// Expand Horizontally
|
||||||
if(height && !width) {
|
if(height && !width) {
|
||||||
|
@ -172,6 +174,7 @@ EPUBJS.View.prototype.expand = function(force) {
|
||||||
this.resize(width, height);
|
this.resize(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._expanding = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
EPUBJS.View.prototype.contentWidth = function(min) {
|
EPUBJS.View.prototype.contentWidth = function(min) {
|
||||||
|
@ -401,7 +404,7 @@ EPUBJS.View.prototype.resizeListenters = function() {
|
||||||
EPUBJS.View.prototype.mediaQueryListeners = function() {
|
EPUBJS.View.prototype.mediaQueryListeners = function() {
|
||||||
var sheets = this.document.styleSheets;
|
var sheets = this.document.styleSheets;
|
||||||
var mediaChangeHandler = function(m){
|
var mediaChangeHandler = function(m){
|
||||||
if(m.matches) {
|
if(m.matches && !this._expanding) {
|
||||||
this.expand();
|
this.expand();
|
||||||
}
|
}
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
@ -425,7 +428,9 @@ EPUBJS.View.prototype.observe = function(target) {
|
||||||
|
|
||||||
// create an observer instance
|
// create an observer instance
|
||||||
var observer = new MutationObserver(function(mutations) {
|
var observer = new MutationObserver(function(mutations) {
|
||||||
|
if(renderer._expanding) {
|
||||||
renderer.expand();
|
renderer.expand();
|
||||||
|
}
|
||||||
// mutations.forEach(function(mutation) {
|
// mutations.forEach(function(mutation) {
|
||||||
// console.log(mutation);
|
// console.log(mutation);
|
||||||
// });
|
// });
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue