Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
fix(dialog): resize top and height on window resize
Browse files Browse the repository at this point in the history
Fixes #4513.
  • Loading branch information
ThomasBurleson committed Sep 18, 2015
1 parent d98f9a7 commit 3e34e02
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/components/dialog/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -606,12 +606,16 @@ function MdDialogProvider($$interimElementProvider) {
* Listen for escape keys and outside clicks to auto close
*/
function activateListeners(element, options) {
var window = angular.element($window);
var onWindowResize = $mdUtil.debounce(function(){
stretchDialogContainerToViewport(element, options);
}, 60);

var removeListeners = [];
var smartClose = function() {
// Only 'confirm' dialogs have a cancel button... escape/clickOutside will
// cancel or fallback to hide.
var closeFn = ( options.$type == 'alert' ) ? $mdDialog.hide : $mdDialog.cancel;

$mdUtil.nextTick(closeFn, true);
};

Expand All @@ -629,11 +633,15 @@ function MdDialogProvider($$interimElementProvider) {
// Add keyup listeners
element.on('keyup', keyHandlerFn);
target.on('keyup', keyHandlerFn);
window.on('resize', onWindowResize);

// Queue remove listeners function
removeListeners.push(function() {

element.off('keyup', keyHandlerFn);
target.off('keyup', keyHandlerFn);
window.off('resize', onWindowResize);

});
}
if (options.clickOutsideToClose) {
Expand Down Expand Up @@ -810,6 +818,9 @@ function MdDialogProvider($$interimElementProvider) {
return animator
.translate3d(dialogEl, from, to, translateOptions)
.then(function(animateReversal) {



// Build a reversal translate function synched to this translation...
options.reverseAnimate = function() {

Expand Down

0 comments on commit 3e34e02

Please sign in to comment.