use of org.terasology.rendering.nui.events.NUIMouseClickEvent in project Terasology by MovingBlocks.
the class BrowserWidget method onDraw.
@Override
public void onDraw(Canvas canvas) {
hyperlinkBoxes.clear();
canvas.addInteractionRegion(new BaseInteractionListener() {
@Override
public boolean onMouseClick(NUIMouseClickEvent event) {
for (HyperlinkBox hyperlinkBox : hyperlinkBoxes) {
if (hyperlinkBox.box.contains(event.getRelativeMousePosition())) {
for (BrowserHyperlinkListener browserHyperlinkListener : listenerList) {
browserHyperlinkListener.hyperlinkClicked(hyperlinkBox.hyperlink);
}
break;
}
}
return true;
}
});
if (displayedPage != null) {
DocumentRenderer.drawDocumentInRegion(displayedPage, canvas, canvas.getCurrentStyle().getFont(), canvas.getCurrentStyle().getTextColor(), canvas.size(), register);
}
}
Aggregations