[Plot] Organize plot elements

Place elements of the PlotController into a separate
directory inside of the source folder for the plot
plug-in, in preparation for review and integration.
Part of ongoing plot transition to Angular, WTD-533.
This commit is contained in:
Victor Woeltjen
2014-12-01 18:21:51 -08:00
parent ad802e674e
commit 86711735b7
8 changed files with 17 additions and 9 deletions

View File

@ -0,0 +1,38 @@
/*global define*/
define(
[],
function () {
"use strict";
function PlotPosition(x, y, width, height, panZoomStack) {
var panZoom = panZoomStack.getPanZoom(),
origin = panZoom.origin,
dimensions = panZoom.dimensions,
position;
if (!dimensions || !origin) {
position = [];
} else {
position = [ x / width, (height - y) / height ].map(function (v, i) {
return v * dimensions[i] + origin[i];
});
}
return {
getDomain: function () {
return position[0];
},
getRange: function () {
return position[1];
},
getPosition: function () {
return position;
}
};
}
return PlotPosition;
}
);