Matching new API.

Moved "Do we need handling" to the LayoutCanvas.
This commit is contained in:
ProfMobius committed 2013-10-29 21:11:45 +01:00
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;
}
+4 -9
View File
@@ -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;
}