1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-08-29 08:42:17 +00:00

fix: Clicking in terminal will now work (tested with paint)

This commit is contained in:
coolsa
2021-10-01 16:08:08 -06:00
parent 9d8e76c5b4
commit abfb05f04c

View File

@@ -79,6 +79,9 @@ public class WidgetTerminal extends ClickableWidget {
Terminal term = computer.getTerminal(); Terminal term = computer.getTerminal();
if( term != null ) if( term != null )
{ {
mouseX -= innerX;
mouseY -= innerY;
System.out.println(mouseX);
int charX = (int) (mouseX / FONT_WIDTH); int charX = (int) (mouseX / FONT_WIDTH);
int charY = (int) (mouseY / FONT_HEIGHT); int charY = (int) (mouseY / FONT_HEIGHT);
charX = Math.min( Math.max( charX, 0 ), term.getWidth() - 1 ); charX = Math.min( Math.max( charX, 0 ), term.getWidth() - 1 );
@@ -103,6 +106,8 @@ public class WidgetTerminal extends ClickableWidget {
Terminal term = computer.getTerminal(); Terminal term = computer.getTerminal();
if( term != null ) if( term != null )
{ {
mouseX -= innerX;
mouseY -= innerY;
int charX = (int) (mouseX / FONT_WIDTH); int charX = (int) (mouseX / FONT_WIDTH);
int charY = (int) (mouseY / FONT_HEIGHT); int charY = (int) (mouseY / FONT_HEIGHT);
charX = Math.min( Math.max( charX, 0 ), term.getWidth() - 1 ); charX = Math.min( Math.max( charX, 0 ), term.getWidth() - 1 );
@@ -130,6 +135,8 @@ public class WidgetTerminal extends ClickableWidget {
Terminal term = computer.getTerminal(); Terminal term = computer.getTerminal();
if( term != null ) if( term != null )
{ {
mouseX -= innerX;
mouseY -= innerY;
int charX = (int) (mouseX / FONT_WIDTH); int charX = (int) (mouseX / FONT_WIDTH);
int charY = (int) (mouseY / FONT_HEIGHT); int charY = (int) (mouseY / FONT_HEIGHT);
charX = Math.min( Math.max( charX, 0 ), term.getWidth() - 1 ); charX = Math.min( Math.max( charX, 0 ), term.getWidth() - 1 );
@@ -155,6 +162,8 @@ public class WidgetTerminal extends ClickableWidget {
Terminal term = computer.getTerminal(); Terminal term = computer.getTerminal();
if( term != null ) if( term != null )
{ {
mouseX -= innerX;
mouseY -= innerY;
int charX = (int) (mouseX / FONT_WIDTH); int charX = (int) (mouseX / FONT_WIDTH);
int charY = (int) (mouseY / FONT_HEIGHT); int charY = (int) (mouseY / FONT_HEIGHT);
charX = Math.min( Math.max( charX, 0 ), term.getWidth() - 1 ); charX = Math.min( Math.max( charX, 0 ), term.getWidth() - 1 );