Force two up view
This commit is contained in:
parent
727f51b8ef
commit
2cd64406c4
1 changed files with 14 additions and 6 deletions
|
@ -11,15 +11,23 @@
|
||||||
function ImageFile(file) {
|
function ImageFile(file) {
|
||||||
this.file = file;
|
this.file = file;
|
||||||
this.requestImageInfo($('.two-up.view .frame.deleted img', this.file), (function(_this) {
|
this.requestImageInfo($('.two-up.view .frame.deleted img', this.file), (function(_this) {
|
||||||
// Determine if old and new file has same dimensions, if not show 'two-up' view
|
|
||||||
return function(deletedWidth, deletedHeight) {
|
return function(deletedWidth, deletedHeight) {
|
||||||
return _this.requestImageInfo($('.two-up.view .frame.added img', _this.file), function(width, height) {
|
return _this.requestImageInfo($('.two-up.view .frame.added img', _this.file), function(width, height) {
|
||||||
if (width === deletedWidth && height === deletedHeight) {
|
_this.initViewModes();
|
||||||
return _this.initViewModes();
|
|
||||||
} else {
|
// Load two-up view after images are loaded
|
||||||
return _this.initView('two-up');
|
// so that we can display the correct width and height information
|
||||||
|
const images = $('.two-up.view img', _this.file);
|
||||||
|
let loadedCount = 0;
|
||||||
|
|
||||||
|
images.on('load', () => {
|
||||||
|
loadedCount += 1;
|
||||||
|
|
||||||
|
if (loadedCount === images.length) {
|
||||||
|
_this.initView('two-up');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
})(this));
|
})(this));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue