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

Commit

Permalink
feat(githut): Dynamic resizing.
Browse files Browse the repository at this point in the history
Closes #677
Matthew Schranz committed Mar 26, 2015
1 parent beecfa7 commit 9000eae
Showing 3 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions app/scripts/components/githut/githut.controllers.ts
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ module ngApp.components.githut.controllers {
class GitHutController implements IGitHutController {

/* @ngInject */
constructor(private $scope: IGitHutScope) {
constructor(private $scope: IGitHutScope, private $window: ng.IWindowService) {
this.draw();

$scope.$watch("data", () => {
@@ -24,6 +24,12 @@ module ngApp.components.githut.controllers {
var data = this.$scope.data,
options = this.$scope.config;

this.$window.$(this.$window).off("resize");

this.$window.$(this.$window).on("resize", _.debounce(() => {
this.draw();
}, 150));

function updateScales() {
// what in the seven kingdoms does this do?
extents = (function(){
@@ -808,7 +814,6 @@ module ngApp.components.githut.controllers {
])) / options.columns.length;
var marker_width = [2, marker_max_width];
var svg = d3.select(options.container)
.style("width", WIDTH + "px")
.append("svg")
.attr("width", WIDTH)
.attr("height", HEIGHT);
1 change: 1 addition & 0 deletions app/scripts/components/githut/module.ts
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ module ngApp.components.githut {
config: "=",
data: "="
},
replace: true,
templateUrl: "components/githut/templates/graph.html",
controller: "GitHutController as ghc"
};
8 changes: 6 additions & 2 deletions app/scripts/components/githut/templates/graph.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<div class="githut">
<div id="pc"></div>
<div class="row">
<div class="col-sm-12">
<div class="githut">
<div id="pc"></div>
</div>
</div>
</div>

0 comments on commit 9000eae

Please sign in to comment.