KrabCode/LazyGui

Grid appears in wrong position when `pixelDensity` is set

Opened this issue · 3 comments

When I set pixelDensity(2) in my sketch, the GUI grid appears offset from the window being dragged. It also appears much smaller than normal. Removing the pixelDensity call restores the expected behavior.

Minimal example:

//import the LazyGUI library
import com.krab.lazy.*;
LazyGui gui;

void setup() {
  size(1200, 800, P2D);
  pixelDensity(2);
  gui = new LazyGui(this);
}

void draw() {
  background(255);
}

I can't reproduce this on my main PC, it tells me
pixelDensity(2) is not available for this display
but maybe I'll be able to reproduce it later on some other machine.

As a temporary workaround for the gui being smaller - you can go into options at runtime and tweak window and font sizes, or do this in setup to set the values from code:

gui.sliderIntSet("options/windows/cell size", 44);
gui.sliderIntSet("options/font/main font size", 32);
gui.sliderIntSet("options/font/side font size", 28);
gui.sliderIntSet("options/font/y offset", 25);

Would this help?

The grid offset is unfortunate, maybe we need a slider or a plot for a manual position offset in the "options/grid" folder.

Ah, yeah, you probably need a hi-density display to enable to that.

It's a minor issue, just thought I'd flag it.
To be clear, it's just the grid that's affected—the GUI is fine. Here's a screenshot that shows the issue.

lazyGuiGrid

Thanks for the screenshot and thanks for flagging the issue. I agree that it's not a high priority issue, but it's good to know.

If someone with a high density display wants to fix it I'm very open to approving pull requests.