Fix Window Dragging going out of bounds.
This commit is contained in:
parent
70e91c46a2
commit
52f2419a3d
BIN
sigIRCv2.jar
BIN
sigIRCv2.jar
Binary file not shown.
@ -106,7 +106,7 @@ public class Module {
|
||||
int mouseY = sigIRC.panel.lastMouseY+(int)dragOffset.getY();
|
||||
int oldX = (int)position.getX();
|
||||
int oldY = (int)position.getY();
|
||||
position = new Rectangle(mouseX, mouseY,(int)position.getWidth(),(int)position.getHeight());
|
||||
position = new Rectangle((int)Math.min(Math.max(0,mouseX),sigIRC.window.getWidth()-position.getWidth()), (int)Math.min(Math.max(titleHeight,mouseY),sigIRC.window.getHeight()-position.getHeight()-titleHeight*2),(int)position.getWidth(),(int)position.getHeight());
|
||||
//System.out.println(sigIRC.panel.lastMouseX+","+sigIRC.panel.lastMouseY);
|
||||
ModuleDragEvent(oldX,oldY,mouseX,mouseY);
|
||||
}
|
||||
@ -145,6 +145,7 @@ public class Module {
|
||||
Module.IMG_DRAGBAR.getHeight(),
|
||||
sigIRC.panel);
|
||||
DrawUtils.drawTextFont(g, sigIRC.panel.smallFont, (int)position.getX(), (int)position.getY()-titleHeight/2+4, Color.BLACK, this.name);
|
||||
//g.fillRect((int)position.getX(), (int)position.getY(), (int)position.getWidth(), (int)position.getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,6 +143,7 @@ public class ControllerModule extends Module{
|
||||
Math.abs((end_drag.getY()-start_drag.getY())/controller_img.getHeight(sigIRC.panel)));
|
||||
//buttons.add(new Button(pct_rect.getX(),pct_rect.getY(),pct_rect.getWidth(),pct_rect.getHeight(),controllers.get(0),Identifier.Button._3,Color.RED,this));
|
||||
//resetDragPoints();
|
||||
sigIRC.panel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||
MODE=EditMode.BUTTONSET;
|
||||
}
|
||||
}
|
||||
@ -185,7 +186,6 @@ public class ControllerModule extends Module{
|
||||
status="Drag a button onto the controller template.";
|
||||
}break;
|
||||
case BUTTONSET:{
|
||||
sigIRC.panel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||
status="Press controller button to set button";
|
||||
}break;
|
||||
case COLORSET:{
|
||||
@ -193,10 +193,6 @@ public class ControllerModule extends Module{
|
||||
}break;
|
||||
default:{
|
||||
status="";
|
||||
int cursortype = sigIRC.panel.getCursor().getType();
|
||||
if (cursortype!=Cursor.DEFAULT_CURSOR) {
|
||||
sigIRC.panel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||
}
|
||||
}
|
||||
}
|
||||
super.run();
|
||||
|
Loading…
x
Reference in New Issue
Block a user