Skip to content

Commit

Permalink
Resize handler now resizes - fix for googleads#554
Browse files Browse the repository at this point in the history
  • Loading branch information
steevee committed Mar 7, 2018
1 parent 6ff9f96 commit aa2d901
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
17 changes: 0 additions & 17 deletions src/ad-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,23 +431,6 @@ AdUi.prototype.onNonLinearAdLoad = function() {
};


/**
* Called when the player wrapper detects that the player has been resized.
*
* @param {number} width The post-resize width of the player.
* @param {number} height The post-resize height of the player.
*/
AdUi.prototype.onPlayerResize = function(width, height) {
if (this.adsManager) {
this.adsManagerDimensions.width = width;
this.adsManagerDimensions.height = height;
/* global google */
/* eslint no-undef: 'error' */
this.adsManager.resize(width, height, google.ima.ViewMode.NORMAL);
}
};


AdUi.prototype.onPlayerEnterFullscreen = function() {
this.addClass(this.fullscreenDiv, 'ima-fullscreen');
this.removeClass(this.fullscreenDiv, 'ima-non-fullscreen');
Expand Down
2 changes: 1 addition & 1 deletion src/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ Controller.prototype.onAdsReady = function() {
* @param {number} height The post-resize height of the player.
*/
Controller.prototype.onPlayerResize = function(width, height) {
this.adUi.onPlayerResize(width, height);
this.sdkImpl.onPlayerResize(width, height);
};


Expand Down
2 changes: 1 addition & 1 deletion src/player-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ PlayerWrapper.prototype.checkForResize = function() {
currentHeight != this.vjsPlayerDimensions.height) {
this.vjsPlayerDimensions.width = currentWidth;
this.vjsPlayerDimensions.height = currentHeight;
this.controller.onPlayerResize();
this.controller.onPlayerResize(currentWidth, currentHeight);
}
};

Expand Down
17 changes: 17 additions & 0 deletions src/sdk-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,23 @@ SdkImpl.prototype.onPlayerVolumeChanged = function(volume) {
};


/**
* Called when the player wrapper detects that the player has been resized.
*
* @param {number} width The post-resize width of the player.
* @param {number} height The post-resize height of the player.
*/
SdkImpl.prototype.onPlayerResize = function(width, height) {
if (this.adsManager) {
this.adsManagerDimensions.width = width;
this.adsManagerDimensions.height = height;
/* global google */
/* eslint no-undef: 'error' */
this.adsManager.resize(width, height, google.ima.ViewMode.NORMAL);
}
};


/**
* @return {Object} The current ad.
*/
Expand Down

0 comments on commit aa2d901

Please sign in to comment.