Skip to content

Commit

Permalink
fix(exposeWhenAside): resize handler is trigger when screen dimension…
Browse files Browse the repository at this point in the history
…s change

This fix is link to the commit 8187367 (@msalcala11)
The resize handler was not triggered often enough, when the view is resize
(screen rotation for instance) the resize handler wasn't trigger.

Refs #4898
  • Loading branch information
5im0n committed Jan 6, 2016
1 parent 3b408f4 commit b5968ca
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions js/angular/directive/exposeAsideWhen.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,17 @@ IonicModule.directive('exposeAsideWhen', ['$window', function($window) {
require: '^ionSideMenus',
link: function($scope, $element, $attr, sideMenuCtrl) {

// Setup a match media query listener that triggers a ui change only when a change
// in media matching status occurs
var mq = $attr.exposeAsideWhen == 'large' ? '(min-width:768px)' : $attr.exposeAsideWhen;
var mql = $window.matchMedia(mq);
mql.addListener(function() {
var prevInnerWidth = $window.innerWidth;
var prevInnerHeight = $window.innerHeight;

ionic.on('resize', function() {
if (prevInnerWidth === $window.innerWidth && prevInnerHeight === $window.innerHeight) {
return;
}
prevInnerWidth = $window.innerWidth;
prevInnerHeight = $window.innerHeight;
onResize();
});
}, $window);

function checkAsideExpose() {
var mq = $attr.exposeAsideWhen == 'large' ? '(min-width:768px)' : $attr.exposeAsideWhen;
Expand Down

0 comments on commit b5968ca

Please sign in to comment.