mirror of
https://github.com/GTNewHorizons/waila.git
synced 2026-11-13 16:54:17 +00:00
Add documentation for IWailaVariableWidthTooltipRenderer (#44)
This commit is contained in:
1 parent
e82729a113
commit
07b9d1bf92
2 files changed
+23
-3
No files matched your search
@@ -1,9 +1,29 @@
|
||||
package mcp.mobius.waila.api;
|
||||
|
||||
/**
|
||||
* Interface for tooltip renderers that adjust their width depending on the width of the rest of the tooltip.
|
||||
* setMaxLineWidth is called by {@link mcp.mobius.waila.overlay.Tooltip} before every tooltip render to inform the
|
||||
* renderer of the width of the longest line in the tooltip.
|
||||
*/
|
||||
public interface IWailaVariableWidthTooltipRenderer extends IWailaTooltipRenderer {
|
||||
|
||||
void setMaxStringW(int width);
|
||||
/**
|
||||
* Informs the renderer of what the length of the longest line is.</br>
|
||||
* Called by {@link mcp.mobius.waila.overlay.Tooltip} before every tooltip render.</br>
|
||||
*
|
||||
* @param width The width of the longest line in the tooltip.
|
||||
*
|
||||
*/
|
||||
void setMaxLineWidth(int width);
|
||||
|
||||
int getMaxStringW();
|
||||
/**
|
||||
* Returns the width of the longest line in the current tooltip.</br>
|
||||
* With icons disabled the tooltip's background box is always 2 pixels wider to the right of the line than it is to
|
||||
* the left.</br>
|
||||
*
|
||||
* @return The width of the longest line in the tooltip
|
||||
*
|
||||
*/
|
||||
int getMaxLineWidth();
|
||||
|
||||
}
|
||||
@@ -183,7 +183,7 @@ public class Tooltip {
|
||||
new Point(offsetX, offsetY),
|
||||
renderMatcher.group("args").split(","));
|
||||
if (renderer instanceof IWailaVariableWidthTooltipRenderer variableWidthRenderer) {
|
||||
variableWidthRenderer.setMaxStringW(maxStringW);
|
||||
variableWidthRenderer.setMaxLineWidth(maxStringW);
|
||||
}
|
||||
this.elements2nd.add(renderable);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user