Namespacing grapher and utilities
This commit is contained in:
parent
bf0faad5ed
commit
797005c9a5
@ -49,7 +49,7 @@
|
|||||||
ctx.hintSteps = query.hintSteps;
|
ctx.hintSteps = query.hintSteps;
|
||||||
ctx.maxResults = query.maxResults;
|
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.setColumns(results.columns);
|
||||||
ctx.grapher.setValueChangedListener(onAdjust);
|
ctx.grapher.setValueChangedListener(onAdjust);
|
||||||
|
|
||||||
|
@ -1,21 +1,22 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
||||||
//
|
(function(grapher) {
|
||||||
// Coord
|
//
|
||||||
//
|
// Coord
|
||||||
|
//
|
||||||
|
|
||||||
function Coord(x, y) {
|
function Coord(x, y) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rect
|
// Rect
|
||||||
//
|
//
|
||||||
|
|
||||||
function Rect(left, top, width, height) {
|
function Rect(left, top, width, height) {
|
||||||
this.left = left;
|
this.left = left;
|
||||||
this.top = top;
|
this.top = top;
|
||||||
this.width = width;
|
this.width = width;
|
||||||
@ -41,14 +42,14 @@ function Rect(left, top, width, height) {
|
|||||||
|
|
||||||
return new Rect(left, top, right - left, bottom - top);
|
return new Rect(left, top, right - left, bottom - top);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Range
|
// Range
|
||||||
//
|
//
|
||||||
|
|
||||||
function Range(start, end) {
|
function Range(start, end) {
|
||||||
this.start = start;
|
this.start = start;
|
||||||
this.end = end;
|
this.end = end;
|
||||||
|
|
||||||
@ -71,14 +72,14 @@ function Range(start, end) {
|
|||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Column
|
// Column
|
||||||
//
|
//
|
||||||
|
|
||||||
function Column(canvas, name, params, scale, range, bounds) {
|
function Column(canvas, name, params, scale, range, bounds) {
|
||||||
this.clearShapes = function() {
|
this.clearShapes = function() {
|
||||||
_.each(this.shapes, function(shape) {
|
_.each(this.shapes, function(shape) {
|
||||||
this.canvas.remove(shape);
|
this.canvas.remove(shape);
|
||||||
@ -453,14 +454,14 @@ function Column(canvas, name, params, scale, range, bounds) {
|
|||||||
this.state = this.State.NORMAL;
|
this.state = this.State.NORMAL;
|
||||||
|
|
||||||
this.updateShapes(true);
|
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.setColumns = function(columns) {
|
||||||
this.clearColumns();
|
this.clearColumns();
|
||||||
|
|
||||||
@ -660,4 +661,5 @@ function Grapher(canvas, range, columnWidth, useLocalScale, useRelativeScale) {
|
|||||||
c.addEventListener('mouseout', this.mouseOut, false);
|
c.addEventListener('mouseout', this.mouseOut, false);
|
||||||
c.addEventListener('dblclick', this.mouseDoubleClick, false);
|
c.addEventListener('dblclick', this.mouseDoubleClick, false);
|
||||||
c.grapher = this;
|
c.grapher = this;
|
||||||
}
|
}
|
||||||
|
}(window.grapher = window.grapher || {}));
|
||||||
|
Loading…
Reference in New Issue
Block a user