Permalink
Browse files

Merge pull request #10397 from LunaMoo/DLEstuff2

Small improvement to and fix for layout screens.
  • Loading branch information...
hrydgard committed Dec 11, 2017
2 parents c00d06a + f06f9f7 commit 372c5e7b6d312bb2e301def27621ec0fbaa42b6d
Showing with 19 additions and 8 deletions.
  1. +15 −8 UI/DisplayLayoutScreen.cpp
  2. +4 −0 UI/NativeApp.cpp
View
@@ -84,6 +84,9 @@ bool DisplayLayoutScreen::touch(const TouchInput &touch) {
int limitX = g_Config.fSmallDisplayZoomLevel * 120;
int limitY = g_Config.fSmallDisplayZoomLevel * 68;
const int quarterResX = local_dp_xres / 4;
const int quarterResY = local_dp_yres / 4;
if (bRotated) {
//swap X/Y limit for rotated display
int limitTemp = limitX;
@@ -92,27 +95,31 @@ bool DisplayLayoutScreen::touch(const TouchInput &touch) {
}
// Check where each edge of the screen is
int windowLeftEdge = local_dp_xres / 4;
int windowRightEdge = windowLeftEdge * 3;
int windowUpperEdge = local_dp_yres / 4;
int windowLowerEdge = windowUpperEdge * 3;
const int windowLeftEdge = quarterResX;
const int windowRightEdge = windowLeftEdge * 3;
const int windowUpperEdge = quarterResY;
const int windowLowerEdge = windowUpperEdge * 3;
// And stick display when close to any edge
stickToEdgeX = false; stickToEdgeY = false;
if (touchX > windowLeftEdge - 8 + limitX && touchX < windowLeftEdge + 8 + limitX) { touchX = windowLeftEdge + limitX; stickToEdgeX = true; }
if (touchX > windowRightEdge - 8 - limitX && touchX < windowRightEdge + 8 - limitX) { touchX = windowRightEdge - limitX; stickToEdgeX = true; }
if (touchY > windowUpperEdge - 8 + limitY && touchY < windowUpperEdge + 8 + limitY) { touchY = windowUpperEdge + limitY; stickToEdgeY = true; }
if (touchY > windowLowerEdge - 8 - limitY && touchY < windowLowerEdge + 8 - limitY) { touchY = windowLowerEdge - limitY; stickToEdgeY = true; }
int minX = local_dp_xres / 2;
int maxX = local_dp_xres + minX;
int minY = local_dp_yres / 2;
int maxY = local_dp_yres + minY;
const int minX = local_dp_xres / 2;
const int maxX = local_dp_xres + minX;
const int minY = local_dp_yres / 2;
const int maxY = local_dp_yres + minY;
// Display visualization disappear outside of those bounds, so we have to limit
if (touchX < -minX) touchX = -minX;
if (touchX > maxX) touchX = maxX;
if (touchY < -minY) touchY = -minY;
if (touchY > maxY) touchY = maxY;
// Limit small display on much larger output a bit differently
if (quarterResX > limitX) limitX = quarterResX;
if (quarterResY > limitY) limitY = quarterResY;
int newX = bounds.centerX(), newY = bounds.centerY();
// Allow moving zoomed in display freely as long as at least noticeable portion of the screen is occupied
if (touchX > minX - limitX - 10 && touchX < minX + limitX + 10) {
View
@@ -1100,6 +1100,10 @@ void NativeResized() {
// NativeResized can come from any thread so we just set a flag, then process it later.
if (g_graphicsInited) {
resized = true;
if (uiContext) {
// Still have to update bounds to avoid problems in display layout and touch controls layout screens
uiContext->SetBounds(Bounds(0, 0, dp_xres, dp_yres));
}
} else {
ILOG("NativeResized ignored, not initialized");
}

0 comments on commit 372c5e7

Please sign in to comment.