Re-usable ScopePanel to replace ScopeContext Plot

This commit is contained in:
Charles J. Cliffe
2015-08-09 12:51:01 -04:00
parent aa6e612d6a
commit db8e7a68d0
11 changed files with 152 additions and 122 deletions
+3 -3
View File
@@ -225,7 +225,7 @@ void GLPanel::drawPanelContents() {
void GLPanel::calcTransform(mat4 transform_in) {
// compute local transform
localTransform = mat4::translate(pos[0], pos[1], 0) * mat4::scale(size[0], size[1], 0);
localTransform = mat4::translate(pos[0], pos[1], 0) * mat4::scale(size[0], size[1], 1);
// compute global transform
transform = transform_in * localTransform;
@@ -250,10 +250,10 @@ void GLPanel::calcTransform(mat4 transform_in) {
pdim = vec2((vmax.x - vmin.x) / 2.0 * view[0], (vmax.y - vmin.y) / 2.0 * view[1]);
pvec = vec2(((vmax.x - vmin.x) / 2.0) / pdim.x, ((vmax.y - vmin.y) / 2.0) / pdim.y);
std::cout << umin << " :: " << ucenter << " :: " << pdim << " :: " << pvec << std::endl;
// std::cout << umin << " :: " << ucenter << " :: " << pdim << " :: " << pvec << std::endl;
if (marginPx) {
transform *= mat4::scale(1.0 - marginPx * 2.0 * pvec.x / size[0], 1.0 - marginPx * 2.0 * pvec.y / size[1], 0);
transform *= mat4::scale(1.0 - marginPx * 2.0 * pvec.x / size[0], 1.0 - marginPx * 2.0 * pvec.y / size[1], 1);
}
}