Notify the tree when the container was probably resized.
This commit is contained in:
parent
898210065e
commit
7c289beba5
4 changed files with 32 additions and 1 deletions
|
@ -117,6 +117,23 @@ quayApp = angular.module('quay', ['restangular', 'angularMoment', 'angulartics',
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}).
|
}).
|
||||||
|
directive('onresize', function ($window, $parse) {
|
||||||
|
return function (scope, element, attr) {
|
||||||
|
var fn = $parse(attr.onresize);
|
||||||
|
|
||||||
|
var notifyResized = function() {
|
||||||
|
scope.$apply(function () {
|
||||||
|
fn(scope);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
angular.element($window).on('resize', null, notifyResized);
|
||||||
|
|
||||||
|
scope.$on('$destroy', function() {
|
||||||
|
angular.element($window).off('resize', null, notifyResized);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}).
|
||||||
config(['$routeProvider', '$locationProvider', '$analyticsProvider',
|
config(['$routeProvider', '$locationProvider', '$analyticsProvider',
|
||||||
function($routeProvider, $locationProvider, $analyticsProvider) {
|
function($routeProvider, $locationProvider, $analyticsProvider) {
|
||||||
|
|
||||||
|
|
|
@ -313,6 +313,12 @@ function RepoCtrl($scope, Restangular, $routeParams, $rootScope, $location) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.$watch('repo', function() {
|
||||||
|
if ($scope.tree) {
|
||||||
|
$scope.tree.notifyResized();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
var listImages = function() {
|
var listImages = function() {
|
||||||
if ($scope.imageHistory) { return; }
|
if ($scope.imageHistory) { return; }
|
||||||
|
|
||||||
|
|
|
@ -136,6 +136,14 @@ ImageHistoryTree.prototype.draw = function(container) {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Redraws the image history to fit the new size.
|
||||||
|
*/
|
||||||
|
ImageHistoryTree.prototype.notifyResized = function() {
|
||||||
|
console.log('Image history container resized.');
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the current tag displayed in the tree.
|
* Sets the current tag displayed in the tree.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -83,7 +83,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Tree View itself -->
|
<!-- Tree View itself -->
|
||||||
<div id="image-history-container"></div>
|
<div id="image-history-container" onresize="tree.notifyResized()"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Reference in a new issue