margin tweaks

This commit is contained in:
Charles J. Cliffe 2015-06-27 01:55:39 -04:00
parent c770a0e20e
commit 8ccb060237
2 changed files with 8 additions and 8 deletions

View File

@ -264,8 +264,8 @@ void GLPanel::draw(CubicVR::mat4 transform_in, GLPanel *parent) {
std::cout << umin << " :: " << ucenter << " :: " << pdim << " :: " << pvec << std::endl;
if (marginPx.left || marginPx.right || marginPx.top || marginPx.bottom) {
localTransform *= mat4::translate(marginPx.left*pvec.x, marginPx.top*pvec.y, 0) *
mat4::scale(1.0-(marginPx.left+marginPx.right)*pvec.x, 1.0-(marginPx.top+marginPx.bottom)*pvec.y, 0);
localTransform *= mat4::translate(marginPx.left*pvec.x/size[0], marginPx.top*pvec.y/size[1], 0) *
mat4::scale(1.0-(marginPx.left+marginPx.right)*pvec.x/size[0], 1.0-(marginPx.top+marginPx.bottom)*pvec.y/size[1], 0);
transform = transform_in * localTransform;
}

View File

@ -12,19 +12,19 @@ PrimaryGLContext(canvas, sharedContext) {
testPanel.setFillColor(RGB(0.0,0.0,1.0), RGB(0.0,1.0,0.0));
testChildPanel.setPosition(0.0, 0.0);
testChildPanel.setMarginPx(10);
testChildPanel.setSize(1.0, 0.3);
testChildPanel.setMarginPx(10,10,10,5);
testChildPanel.setSize(1.0, 0.5);
testChildPanel.setFill(GLPanel::GLPANEL_FILL_GRAD_BAR_X);
testChildPanel.setFillColor(RGB(0.0,0.0,1.0), RGB(0.0,1.0,0.0));
testChildPanel.setBorderPx(1);
testChildPanel2.setPosition(0.0, 0.3);
testChildPanel2.setSize(1.0, 0.3);
testChildPanel2.setMarginPx(10);
testChildPanel2.setPosition(0.0, 0.5);
testChildPanel2.setSize(1.0, 0.5);
testChildPanel2.setMarginPx(10,10,5,10);
testChildPanel2.setFill(GLPanel::GLPANEL_FILL_GRAD_X);
testChildPanel2.setFillColor(RGB(0.0,0.0,1.0), RGB(0.0,1.0,0.0));
testChildPanel2.setBorderColor(RGB(1.0,0.0,0.0));
testChildPanel2.setBorderPx(2,4,6,8);
testChildPanel2.setBorderPx(1);
testPanel.addChild(&testChildPanel);
testPanel.addChild(&testChildPanel2);