1

Namespacing grapher and utilities

This commit is contained in:
Alex Yatskov 2014-09-27 10:10:45 +09:00
parent bf0faad5ed
commit 797005c9a5
2 changed files with 581 additions and 579 deletions

View File

@ -49,7 +49,7 @@
ctx.hintSteps = query.hintSteps;
ctx.maxResults = query.maxResults;
ctx.grapher = new Grapher('grapher', ctx.searchRange, 150, true, true);
ctx.grapher = new grapher.Grapher('grapher', ctx.searchRange, 150, true, true);
ctx.grapher.setColumns(results.columns);
ctx.grapher.setValueChangedListener(onAdjust);

View File

@ -1,21 +1,22 @@
'use strict';
//
// Coord
//
(function(grapher) {
//
// Coord
//
function Coord(x, y) {
function Coord(x, y) {
this.x = x;
this.y = y;
}
}
//
// Rect
//
//
// Rect
//
function Rect(left, top, width, height) {
function Rect(left, top, width, height) {
this.left = left;
this.top = top;
this.width = width;
@ -41,14 +42,14 @@ function Rect(left, top, width, height) {
return new Rect(left, top, right - left, bottom - top);
};
}
}
//
// Range
//
//
// Range
//
function Range(start, end) {
function Range(start, end) {
this.start = start;
this.end = end;
@ -71,14 +72,14 @@ function Range(start, end) {
return value;
}
}
}
//
// Column
//
//
// Column
//
function Column(canvas, name, params, scale, range, bounds) {
function Column(canvas, name, params, scale, range, bounds) {
this.clearShapes = function() {
_.each(this.shapes, function(shape) {
this.canvas.remove(shape);
@ -453,14 +454,14 @@ function Column(canvas, name, params, scale, range, bounds) {
this.state = this.State.NORMAL;
this.updateShapes(true);
}
}
//
// Grapher
//
//
// Grapher
//
function Grapher(canvas, range, columnWidth, useLocalScale, useRelativeScale) {
grapher.Grapher = function(canvas, range, columnWidth, useLocalScale, useRelativeScale) {
this.setColumns = function(columns) {
this.clearColumns();
@ -660,4 +661,5 @@ function Grapher(canvas, range, columnWidth, useLocalScale, useRelativeScale) {
c.addEventListener('mouseout', this.mouseOut, false);
c.addEventListener('dblclick', this.mouseDoubleClick, false);
c.grapher = this;
}
}
}(window.grapher = window.grapher || {}));