Browse Source

Fix MenuButton width. Round pixel ratio down.

tags/v1.0.0
Andrew Belt 5 years ago
parent
commit
e623048abe
2 changed files with 6 additions and 2 deletions
  1. +1
    -1
      src/app/Toolbar.cpp
  2. +5
    -1
      src/window.cpp

+ 1
- 1
src/app/Toolbar.cpp View File

@@ -24,7 +24,7 @@ namespace app {

struct MenuButton : ui::Button {
void step() override {
box.size.x = bndLabelWidth(APP->window->vg, -1, text.c_str());
box.size.x = bndLabelWidth(APP->window->vg, -1, text.c_str()) + 1.0;
widget::Widget::step();
}
void draw(const widget::DrawContext &ctx) override {


+ 5
- 1
src/window.cpp View File

@@ -209,6 +209,10 @@ Window::Window() {
exit(1);
}

float pixelRatio;
glfwGetWindowContentScale(win, &pixelRatio, NULL);
INFO("Pixel ratio: %f", pixelRatio);

glfwSetWindowSizeLimits(win, 800, 600, GLFW_DONT_CARE, GLFW_DONT_CARE);
if (settings.windowSize.isZero()) {
glfwMaximizeWindow(win);
@@ -349,7 +353,7 @@ void Window::run() {
// Get desired scaling
float pixelRatio;
glfwGetWindowContentScale(win, &pixelRatio, NULL);
pixelRatio = std::round(pixelRatio);
pixelRatio = std::floor(pixelRatio + 0.25);
if (pixelRatio != this->pixelRatio) {
APP->event->handleZoom();
this->pixelRatio = pixelRatio;


Loading…
Cancel
Save