this.prepareTexture(turning.flip[1], function (t1) {
$this.prepareTexture(turning.flip[0], function (t2) {
$this.texturesLoaded(t1, t2, turning.dir, callback);
- });
- })
+ }, turning.dir > 0);
+ }, turning.dir < 0);
},
getPerformancesTestResult: function () {
}
},
- prepareTexture: function (page, callback) {
+ prepareTexture: function (page, callback, enter) {
if (null === THREE) {
return;
}
+ if (enter === undefined) {
+ enter = true;
+ }
this.fluidbook.loader.getTexture(page, function (image) {
var texture = new THREE.Texture(image);
texture.needsUpdate = true;
callback(texture);
- });
+ }, enter);
},
initTurn: function (dir) {
if (this.fluidbook.pagetransitions.flip3d !== false) {
$_callback = function () {
- $this.loadTexture(page, callback);
+ $this.loadTexture(page, function () {
+ if ($this.needSeparateTextures(page)) {
+ $this.loadTexture(page, callback, false);
+ } else {
+ callback();
+ }
+ }, true);
};
} else {
$_callback = callback;
this.backgrounds[page] = this.loadImage(url, null, null, null, page, callback);
},
needSeparateTextures: function (page) {
- return this.fluidbook.settings.clinks[page].indexOf('data-animation-hide') >= 0;
+ return this.fluidbook.settings.clinks[page].indexOf('data-animation-hide') >= 0 ||
+ this.fluidbook.settings.clinks[page].indexOf('data-animation-hide-on-leave') >= 0;
},
loadTexture: function (page, callback, enter) {
if (enter === undefined) {
}
- if (this.textures[page] !== undefined && this.textures[page] !== null) {
+ if (
+ (enter && this.textures[page] !== undefined && this.textures[page] !== null) ||
+ (!enter && this.leaveTextures[page] !== undefined && this.leaveTextures[page] !== null)
+ ) {
callback();
} else {
try {
}
};
$('.texture_clinks[data-page="' + page + '"] .contentLink[data-image]').each(function () {
- if (enter && $(this).data('animation-hide')) {
+ if ((enter && $(this).is('[data-animation-hide]')) || (!enter && $(this).is('[data-animation-hide-on-leave]'))) {
return;
}
nb++;
}
var $this = this;
var clinks = this.handleExtension(this.fluidbook.settings.clinks[page]);
- this._preloadContentLinkTextures(page,clinks, enter, function (textures) {
+ this._preloadContentLinkTextures(page, clinks, enter, function (textures) {
var d = 1024;
var c = document.getElementById("pscanvas");
c.width = d;
if (clinks !== '') {
$('.texture_clinks[data-page="' + page + '"] .contentLink').each(function () {
- if (enter && $(this).data('animation-hide')) {
+ if ((enter && $(this).is('[data-animation-hide]')) || (!enter && $(this).is('[data-animation-hide-on-leave]'))) {
return;
}
var left = parseFloat($(this).css('left')) * wr;
var i = new Image();
i.onload = function () {
- $this.textures[page] = i;
+ if (enter) {
+ $this.textures[page] = i;
+ } else {
+ $this.leaveTextures[page] = i;
+ }
callback();
}
i.src = c.toDataURL("image/png");
});
},
- getTexture: function (page, callback) {
+ getTexture: function (page, callback, enter) {
+ if (enter === undefined) {
+ enter = true;
+ }
var $this = this;
+ var t = enter || !this.needSeparateTextures(page) ? 'textures' : 'leaveTextures';
- if (this.textures[page] === undefined) {
+ if (this[t][page] === undefined || this[t][page] === null) {
this._preloadPage(page, function () {
- callback($this.textures[page]);
+ callback($this[t][page]);
});
} else {
- callback(this.textures[page]);
+ callback(this[t][page]);
}
},