Skip to content

Commit

Permalink
ignore resize events when element (e.g. video) enters/exits fullscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
mkhazov committed May 22, 2017
1 parent 53f9dfa commit 4d7a644
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
15 changes: 15 additions & 0 deletions dist/packery.pkgd.js
Original file line number Diff line number Diff line change
Expand Up @@ -3125,6 +3125,14 @@ proto.resize = function() {
* @returns Boolean
*/
proto.needsResizeLayout = function() {
if (this.isFullscreen()) {
this.fullscreen = true;
return false;
} else if (this.fullscreen) {
this.fullscreen = false;
return false;
}

var size = getSize( this.element );
var innerSize = this._getOption('horizontal') ? 'innerHeight' : 'innerWidth';
return size[ innerSize ] != this.size[ innerSize ];
Expand Down Expand Up @@ -3162,6 +3170,13 @@ proto.resizeShiftPercentLayout = function() {
this.shiftLayout();
};

proto.isFullscreen = function() {
return !!document.fullscreenElement ||
!!document.webkitFullscreenElement ||
!!document.mozFullScreenElement ||
!!document.msFullscreenElement;
};

// -------------------------- drag -------------------------- //

/**
Expand Down
Loading

0 comments on commit 4d7a644

Please sign in to comment.