mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
feat(modal): On larger displays modals will be inset and centered, not full width/height, closes #783
This commit is contained in:
18
js/ext/angular/src/service/ionicModal.js
vendored
18
js/ext/angular/src/service/ionicModal.js
vendored
@@ -82,6 +82,8 @@ angular.module('ionic.service.modal', ['ionic.service.templateLoad', 'ionic.serv
|
||||
var self = this;
|
||||
var modalEl = angular.element(self.modalEl);
|
||||
|
||||
self.el.classList.remove('hide');
|
||||
|
||||
$document[0].body.classList.add('modal-open');
|
||||
|
||||
self._isShown = true;
|
||||
@@ -97,13 +99,14 @@ angular.module('ionic.service.modal', ['ionic.service.templateLoad', 'ionic.serv
|
||||
$timeout(function(){
|
||||
modalEl.addClass('ng-enter-active');
|
||||
self.scope.$parent && self.scope.$parent.$broadcast('modal.shown');
|
||||
self.el.classList.add('active');
|
||||
}, 20);
|
||||
|
||||
self._deregisterBackButton = $ionicPlatform.registerBackButtonAction(function(){
|
||||
self.hide();
|
||||
}, 200);
|
||||
|
||||
ionic.views.Modal.prototype.show.call(this);
|
||||
ionic.views.Modal.prototype.show.call(self);
|
||||
|
||||
},
|
||||
|
||||
@@ -113,9 +116,11 @@ angular.module('ionic.service.modal', ['ionic.service.templateLoad', 'ionic.serv
|
||||
* @description Hide this modal instance.
|
||||
*/
|
||||
hide: function() {
|
||||
this._isShown = false;
|
||||
var modalEl = angular.element(this.modalEl);
|
||||
var self = this;
|
||||
self._isShown = false;
|
||||
var modalEl = angular.element(self.modalEl);
|
||||
|
||||
self.el.classList.remove('active');
|
||||
modalEl.addClass('ng-leave');
|
||||
|
||||
$timeout(function(){
|
||||
@@ -125,13 +130,14 @@ angular.module('ionic.service.modal', ['ionic.service.templateLoad', 'ionic.serv
|
||||
|
||||
$timeout(function(){
|
||||
$document[0].body.classList.remove('modal-open');
|
||||
self.el.classList.add('hide');
|
||||
}, 350);
|
||||
|
||||
ionic.views.Modal.prototype.hide.call(this);
|
||||
ionic.views.Modal.prototype.hide.call(self);
|
||||
|
||||
this.scope.$parent && this.scope.$parent.$broadcast('modal.hidden');
|
||||
self.scope.$parent && self.scope.$parent.$broadcast('modal.hidden');
|
||||
|
||||
this._deregisterBackButton && this._deregisterBackButton();
|
||||
self._deregisterBackButton && self._deregisterBackButton();
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user