Skip to content

Commit

Permalink
Fix indentation in TypeScript files.
Browse files Browse the repository at this point in the history
As discussed in the parent commit, indentation was deliberately
wrong in order to minimize file changes. This commit indents all
of the TypeScript files correctly.
  • Loading branch information
tbekolay committed Aug 10, 2016
1 parent 3f1376d commit adf698c
Show file tree
Hide file tree
Showing 28 changed files with 6,454 additions and 6,454 deletions.
188 changes: 94 additions & 94 deletions nengo_gui/static/components/2d_axes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,102 +14,102 @@ import * as d3 from "d3";

export default class Axes2D {

constructor(parent, args) {
var self = this;

this.max_y_width = 100;

// Draw the plot as an SVG
this.svg = d3.select(parent).append('svg')
.attr('width', '100%')
.attr('height', '100%');

// Scales for mapping x and y values to pixels
this.scale_x = d3.scale.linear();
this.scale_y = d3.scale.linear();
this.scale_y.domain([args.min_value, args.max_value]);

// Spacing between the graph and the outside edges (in pixels)
this.set_axes_geometry(args.width, args.height);

// Define the x-axis
this.axis_x = d3.svg.axis()
.scale(this.scale_x)
.orient("bottom")
.ticks(2);

this.axis_x_g = this.svg.append("g")
.attr("class", "axis axis_x unselectable")
.call(this.axis_x);

// Define the y-axis
this.axis_y = d3.svg.axis()
.scale(this.scale_y)
.orient("left")
.tickValues([args.min_value, args.max_value]);

this.axis_y_g = this.svg.append("g")
.attr("class", "axis axis_y unselectable")
.call(this.axis_y);
};

set_axes_geometry(width, height) {
var scale = parseFloat($('#main').css('font-size'));
this.width = width;
this.height = height;
this.ax_left = this.max_y_width;
this.ax_right = width - 1.75 * scale;
this.ax_bottom = height - 1.75 * scale;
this.ax_top = 1.75 * scale;

this.tick_size = 0.4 * scale;
this.tick_padding = 0.2 * scale;
};
constructor(parent, args) {
var self = this;

this.max_y_width = 100;

// Draw the plot as an SVG
this.svg = d3.select(parent).append('svg')
.attr('width', '100%')
.attr('height', '100%');

// Scales for mapping x and y values to pixels
this.scale_x = d3.scale.linear();
this.scale_y = d3.scale.linear();
this.scale_y.domain([args.min_value, args.max_value]);

// Spacing between the graph and the outside edges (in pixels)
this.set_axes_geometry(args.width, args.height);

// Define the x-axis
this.axis_x = d3.svg.axis()
.scale(this.scale_x)
.orient("bottom")
.ticks(2);

this.axis_x_g = this.svg.append("g")
.attr("class", "axis axis_x unselectable")
.call(this.axis_x);

// Define the y-axis
this.axis_y = d3.svg.axis()
.scale(this.scale_y)
.orient("left")
.tickValues([args.min_value, args.max_value]);

this.axis_y_g = this.svg.append("g")
.attr("class", "axis axis_y unselectable")
.call(this.axis_y);
};

/**
* Adjust the graph layout due to changed size
*/
on_resize(width, height) {
if (width < this.minWidth) {
width = this.minWidth;
}
if (height < this.minHeight) {
height = this.minHeight;
set_axes_geometry(width, height) {
var scale = parseFloat($('#main').css('font-size'));
this.width = width;
this.height = height;
this.ax_left = this.max_y_width;
this.ax_right = width - 1.75 * scale;
this.ax_bottom = height - 1.75 * scale;
this.ax_top = 1.75 * scale;

this.tick_size = 0.4 * scale;
this.tick_padding = 0.2 * scale;
};
this.set_axes_geometry(width, height);

this.scale_x.range([this.ax_left, this.ax_right]);
this.scale_y.range([this.ax_bottom, this.ax_top]);

// Adjust positions of x axis on resize
this.axis_x
.tickPadding(this.tick_padding)
.outerTickSize(this.tick_size, this.tick_size);
this.axis_y
.tickPadding(this.tick_padding)
.outerTickSize(this.tick_size, this.tick_size);

this.axis_x_g.attr("transform", "translate(0," + this.ax_bottom + ")");
this.axis_x_g.call(this.axis_x);
this.axis_y_g.attr("transform", "translate(" + this.ax_left + ", 0)");
this.axis_y_g.call(this.axis_y);
};

fit_ticks(parent) {
var self = this;
setTimeout(function() {
var ticks = $(parent.div).find('.tick');
var max_w = 0;
for (var i = 0; i < ticks.length; i++) {
var w = ticks[i].getBBox().width;
if (w > max_w) {
max_w = w;
}

/**
* Adjust the graph layout due to changed size
*/
on_resize(width, height) {
if (width < this.minWidth) {
width = this.minWidth;
}
self.max_y_width = max_w;
self.set_axes_geometry();
self.on_resize(parent.width, parent.height);
}, 1);
};
if (height < this.minHeight) {
height = this.minHeight;
};
this.set_axes_geometry(width, height);

this.scale_x.range([this.ax_left, this.ax_right]);
this.scale_y.range([this.ax_bottom, this.ax_top]);

// Adjust positions of x axis on resize
this.axis_x
.tickPadding(this.tick_padding)
.outerTickSize(this.tick_size, this.tick_size);
this.axis_y
.tickPadding(this.tick_padding)
.outerTickSize(this.tick_size, this.tick_size);

this.axis_x_g.attr("transform", "translate(0," + this.ax_bottom + ")");
this.axis_x_g.call(this.axis_x);
this.axis_y_g.attr("transform", "translate(" + this.ax_left + ", 0)");
this.axis_y_g.call(this.axis_y);
};

fit_ticks(parent) {
var self = this;
setTimeout(function() {
var ticks = $(parent.div).find('.tick');
var max_w = 0;
for (var i = 0; i < ticks.length; i++) {
var w = ticks[i].getBBox().width;
if (w > max_w) {
max_w = w;
}
}
self.max_y_width = max_w;
self.set_axes_geometry();
self.on_resize(parent.width, parent.height);
}, 1);
};

}
Loading

0 comments on commit adf698c

Please sign in to comment.