Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
aba9092
- Added a localisation parameter (defaults to true) to "toString" in
bubblobill Jan 17, 2026
81fe8eb
now with spotless
bubblobill Jan 18, 2026
7be75c5
Added state and bar data to StatSheetContext
bubblobill Jan 18, 2026
21ca23a
Added Jackson2 JSON helpers/resolvers for Handlebars
bubblobill Jan 20, 2026
6a9f7d5
Merge branch 'RPTools:develop' into states_and_bars_on_stat_sheets
bubblobill Jan 20, 2026
4f4e072
Merge remote-tracking branch 'bb/states_and_bars_on_stat_sheets' into…
bubblobill Jan 20, 2026
9594f2a
Changes to StatSheetContext:
bubblobill Jan 20, 2026
8c24e81
Added documentation for extra bits
bubblobill Jan 20, 2026
e920227
- new Developer option EnableHandlebarsDebugging
bubblobill Jan 20, 2026
b4456d3
Access change
bubblobill Jan 20, 2026
6b0c11f
added aspect-ratio information for images
bubblobill Jan 21, 2026
ea7a288
formatting
bubblobill Jan 21, 2026
3f5bab0
Fixed character set in HBDebugUtil.
bubblobill Mar 17, 2026
d16aa51
Merge branch 'develop' into states_and_bars_on_stat_sheets
bubblobill Mar 17, 2026
165059e
Conflict resolution
bubblobill Mar 17, 2026
c6bf420
Add isAltDown to SwingUtil.
bubblobill Mar 18, 2026
55e8788
Removed Handlebars debugging utility
bubblobill Mar 20, 2026
0493dad
formatting
bubblobill Mar 20, 2026
9a84e35
Merge branch 'develop' into states_and_bars_on_stat_sheets
bubblobill Apr 3, 2026
cdf42f3
Merge branch 'RPTools:develop' into states_and_bars_on_stat_sheets
bubblobill May 13, 2026
401a829
Merge branch 'RPTools:develop' into states_and_bars_on_stat_sheets
bubblobill Jun 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jsvg = { group = "com.github.weisj", name = "jsvg", version = "1.4.0" }

handlebars = { group = "com.github.jknack", name = "handlebars", version.ref = "handlebars" }
handlebars-helpers = { group = "com.github.jknack", name = "handlebars-helpers", version.ref = "handlebars" }
handlebars-json = { group = "com.github.jknack", name = "handlebars-jackson2", version = "4.3.1" }

# Apache commons and other utilities
# parsing of configuration data
Expand Down Expand Up @@ -213,7 +214,7 @@ flatlaf = [
"flatlaf-extras",
"flatlaf-jide-oss",
]
handlebars = ["handlebars", "handlebars-helpers"]
handlebars = ["handlebars", "handlebars-helpers", "handlebars-json"]
junit = ["junit-api", "junit-engine", "junit-params"]
jai-imageio = ["jai-imageio-core", "jai-imageio-jpeg"]
graalvm-js = ["graalvm-js", "graalvm-js-scriptengine"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@
* @param zone the zone that the token is in.
* @param shiftDown is the shift key down.
* @param controlDown is the control key down.
* @param altDown is the alt-key down.
*/
public record TokenHoverEnter(Token token, Zone zone, boolean shiftDown, boolean controlDown) {}
public record TokenHoverEnter(
Token token, Zone zone, boolean shiftDown, boolean controlDown, boolean altDown) {}
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@
* @param zone the zone for the event.
* @param shiftDown is the shift key down.
* @param controlDown is the control key down.
* @param altDown is the alt-key down.
*/
public record TokenHoverExit(Token token, Zone zone, boolean shiftDown, boolean controlDown) {}
public record TokenHoverExit(
Token token, Zone zone, boolean shiftDown, boolean controlDown, boolean altDown) {}
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@ private Object getProperties(
seg, coords[0], coords[1], coords[2], coords[3], coords[4], coords[5], coords[6]));
pi.next();
}

StringBuilder stringBuilder = new StringBuilder(sd.toNonLocalisedString());
stringBuilder.append("segments=").append(String.join(",", segments)).append(";");

Expand Down
16 changes: 16 additions & 0 deletions src/main/java/net/rptools/maptool/client/swing/SwingUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,22 @@ public static boolean isShiftDown(int modifiers) {
return (modifiers & InputEvent.SHIFT_DOWN_MASK) == InputEvent.SHIFT_DOWN_MASK;
}

public static boolean isAltDown(InputEvent e) {
return isAltDown(e.getModifiersEx());
}

/**
* Passed the event's extended modifiers this method returns <code>true</code> if the Alt key,
* Right Alt key or Alt-Graph key is down.
*
* @param modifiers as returned by {@link InputEvent#getModifiersEx()}
* @return <code>true</code> if Alt/Right-Alt/Alt-Graph key is down
*/
public static boolean isAltDown(int modifiers) {
return (modifiers & InputEvent.ALT_DOWN_MASK) == InputEvent.ALT_DOWN_MASK
|| (modifiers & InputEvent.ALT_GRAPH_DOWN_MASK) == InputEvent.ALT_GRAPH_DOWN_MASK;
}

/**
* Centers the innerWindow over the outerWindow. Basically, this method finds the centerpoint of
* the <code>outerWindow</code> and sets the location of <code>innerWindow</code> so that it's
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,8 @@ public void mouseMoved(MouseEvent e) {
oldTokenUnderMouse,
getZone(),
SwingUtil.isShiftDown(keysDown),
SwingUtil.isControlDown(keysDown)));
SwingUtil.isControlDown(keysDown),
SwingUtil.isAltDown(keysDown)));
}
} else if (tokenUnderMouse != oldTokenUnderMouse) {
statSheet = null;
Expand All @@ -657,7 +658,8 @@ public void mouseMoved(MouseEvent e) {
oldTokenUnderMouse,
getZone(),
SwingUtil.isShiftDown(keysDown),
SwingUtil.isControlDown(keysDown)));
SwingUtil.isControlDown(keysDown),
SwingUtil.isAltDown(keysDown)));
}
new MapToolEventBus()
.getMainEventBus()
Expand All @@ -666,7 +668,8 @@ public void mouseMoved(MouseEvent e) {
tokenUnderMouse,
getZone(),
SwingUtil.isShiftDown(keysDown),
SwingUtil.isControlDown(keysDown)));
SwingUtil.isControlDown(keysDown),
SwingUtil.isAltDown(keysDown)));
}
Token marker = renderer.getMarkerAt(mouseX, mouseY);
if (!AppUtil.tokenIsVisible(renderer.getZone(), marker, renderer.getPlayerView())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,38 @@
*/
package net.rptools.maptool.client.ui.sheet.stats;

import com.github.jknack.handlebars.*;
import java.io.IOException;
import java.net.URL;
import java.util.*;
import javafx.application.Platform;
import net.rptools.maptool.client.AppConstants;
import net.rptools.maptool.client.MapTool;
import net.rptools.maptool.client.events.TokenHoverEnter;
import net.rptools.maptool.client.ui.htmlframe.HTMLContent;
import net.rptools.maptool.model.Token;
import net.rptools.maptool.model.sheet.stats.StatSheetContext;
import net.rptools.maptool.model.sheet.stats.StatSheetLocation;
import net.rptools.maptool.util.HandlebarsUtil;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/** Class that represents a pop up stat sheet. */
public class StatSheet {

/** Object for logging messages. */
private static final Logger log = LogManager.getLogger(StatSheet.class);
private static final Logger log = LoggerFactory.getLogger(StatSheet.class);

/**
* Sets the content for the stat sheet. The content is a HTML page that is rendered using the
* Handlebars template engine.
*
* @param token the token to render the stat sheet for.
* @param event the token hover event triggering the stat-sheet rendering.
* @param content the content of the stat sheet.
* @param location the location of the stat sheet.
*/
public void setContent(Token token, String content, URL entry, StatSheetLocation location) {
public void setContent(
TokenHoverEnter event, String content, URL entry, StatSheetLocation location) {
try {
var statSheetContext = new StatSheetContext(token, MapTool.getPlayer(), location);
var statSheetContext = new StatSheetContext(event, MapTool.getPlayer(), location);
var output =
HTMLContent.htmlFromString(new HandlebarsUtil<>(content, entry).apply(statSheetContext))
.injectURLBase(entry);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ public void onHoverEnter(TokenHoverEnter event) {
var token = event.token();
if (MapTool.getPlayer().isGM()
|| AppUtil.playerOwns(token)
|| token.getType() != Type.NPC) {
|| token.getType() == Type.NPC) {
statSheet.setContent(
event.token(),
event,
ssManager.getStatSheetContent(ssId),
ssRecord.entry(),
ssProperties.location());
Expand Down
Loading
Loading