mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-08-30 17:17:55 +00:00
Center printout rendering, fix printout gui not responding to page turning inputs.
Fixes: - Printouts being drawn slightly offset to the left in all cases, noticeable mainly when in item frames. - Printout text two pixels off center within the background. - Printout GUI not responding to left/right arrows. Scrolling seemed to work but same fix was added there for consistency.
This commit is contained in:
@@ -53,8 +53,7 @@ public class GuiPrintout extends AbstractContainerScreen<ContainerHeldItem>
|
||||
@Override
|
||||
public boolean keyPressed( int key, int scancode, int modifiers )
|
||||
{
|
||||
if( super.keyPressed( key, scancode, modifiers ) ) return true;
|
||||
|
||||
// Check for key presses.
|
||||
if( key == GLFW.GLFW_KEY_RIGHT )
|
||||
{
|
||||
if( page < pages - 1 ) page++;
|
||||
@@ -67,13 +66,16 @@ public class GuiPrintout extends AbstractContainerScreen<ContainerHeldItem>
|
||||
return true;
|
||||
}
|
||||
|
||||
// Otherwise, default to parent function
|
||||
if( super.keyPressed( key, scancode, modifiers ) ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseScrolled( double x, double y, double delta )
|
||||
{
|
||||
if( super.mouseScrolled( x, y, delta ) ) return true;
|
||||
// Check for key presses.
|
||||
if( delta < 0 )
|
||||
{
|
||||
// Scroll up goes to the next page
|
||||
@@ -88,6 +90,9 @@ public class GuiPrintout extends AbstractContainerScreen<ContainerHeldItem>
|
||||
return true;
|
||||
}
|
||||
|
||||
// Otherwise, default to parent function
|
||||
if( super.mouseScrolled( x, y, delta ) ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -63,7 +63,7 @@ public final class ItemPrintoutRenderer extends ItemMapLikeRenderer
|
||||
double height = LINES_PER_PAGE * FONT_HEIGHT + Y_TEXT_MARGIN * 2;
|
||||
|
||||
// Non-books will be left aligned
|
||||
if( !book ) width += offsetAt( pages );
|
||||
if( !book ) width += offsetAt( pages - 1 );
|
||||
|
||||
double visualWidth = width, visualHeight = height;
|
||||
|
||||
|
@@ -32,12 +32,12 @@ public final class PrintoutRenderer
|
||||
/**
|
||||
* Padding between the left and right of a page and the text.
|
||||
*/
|
||||
public static final int X_TEXT_MARGIN = 13;
|
||||
public static final int X_TEXT_MARGIN = 11;
|
||||
|
||||
/**
|
||||
* Padding between the top and bottom of a page and the text.
|
||||
*/
|
||||
public static final int Y_TEXT_MARGIN = 11;
|
||||
public static final int Y_TEXT_MARGIN = 10;
|
||||
|
||||
/**
|
||||
* Width of the extra page texture.
|
||||
|
Reference in New Issue
Block a user