mirror of
https://github.com/GTNewHorizons/Opis.git
synced 2026-11-23 21:49:42 +00:00
Matching new API.
Moved "Do we need handling" to the LayoutCanvas.
This commit is contained in:
1 parent
7e7f48fb11
commit
fdae9a2a4d
3 files changed
+15
-10
No files matched your search
@@ -119,4 +119,14 @@ public class LayoutCanvas extends LayoutBase{
|
||||
else
|
||||
super.onMouseDrag(event);
|
||||
}
|
||||
|
||||
public boolean hasWidgetAtCursor(){
|
||||
double x = (double)Mouse.getEventX() * (double)this.getSize().getX() / (double)this.mc.displayWidth;
|
||||
double y = (double)this.getSize().getY() - (double)Mouse.getEventY() * (double)this.getSize().getY() / (double)this.mc.displayHeight - 1.0;
|
||||
IWidget widget = this.getWidgetAtCoordinates(x, y);
|
||||
if (widget != null && !widget.equals(this)){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -105,7 +105,7 @@ public class OverlayLoadedChunks implements IMwDataProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMouseInput() {
|
||||
public boolean onMouseInput(MapView mapview, MapMode mapmode) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -217,15 +217,10 @@ public class OverlayMeanTime implements IMwDataProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMouseInput() {
|
||||
if (this.canvas.shouldRender()){
|
||||
double x = (double)Mouse.getEventX() * (double)this.canvas.getSize().getX() / (double)Minecraft.getMinecraft().displayWidth;
|
||||
double y = (double)this.canvas.getSize().getY() - (double)Mouse.getEventY() * (double)this.canvas.getSize().getY() / (double)Minecraft.getMinecraft().displayHeight - 1.0;
|
||||
IWidget widget = this.canvas.getWidgetAtCoordinates(x, y);
|
||||
if (widget != null && !widget.equals(this.canvas)){
|
||||
this.canvas.handleMouseInput();
|
||||
return true;
|
||||
}
|
||||
public boolean onMouseInput(MapView mapview, MapMode mapmode) {
|
||||
if (this.canvas.shouldRender() && ((LayoutCanvas)this.canvas).hasWidgetAtCursor()){
|
||||
this.canvas.handleMouseInput();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user