use of eu.hansolo.tilesfx.tools.InfoRegion in project tilesfx by HanSolo.
the class TileSkin method initGraphics.
// ******************** Initialization ************************************
protected void initGraphics() {
// Set initial size
if (Double.compare(tile.getPrefWidth(), 0.0) <= 0 || Double.compare(tile.getPrefHeight(), 0.0) <= 0 || Double.compare(tile.getWidth(), 0.0) <= 0 || Double.compare(tile.getHeight(), 0.0) <= 0) {
if (tile.getPrefWidth() > 0 && tile.getPrefHeight() > 0) {
tile.setPrefSize(tile.getPrefWidth(), tile.getPrefHeight());
} else {
tile.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
}
}
shadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 3, 0, 0, 0);
backgroundImageView = new ImageView();
backgroundImageView.setPreserveRatio(true);
backgroundImageView.setMouseTransparent(true);
if (null == tile.getBackgroundImage()) {
enableNode(backgroundImageView, false);
} else {
backgroundImageView.setImage(tile.getBackgroundImage());
enableNode(backgroundImageView, true);
}
notifyRegion = new NotifyRegion();
enableNode(notifyRegion, false);
infoRegion = new InfoRegion();
infoRegion.setPickOnBounds(false);
enableNode(infoRegion, false);
lowerRightRegion = new LowerRightRegion();
enableNode(lowerRightRegion, false);
pane = new Pane(backgroundImageView, notifyRegion, infoRegion, lowerRightRegion);
pane.getStyleClass().add("tile");
pane.setBorder(new Border(new BorderStroke(tile.getBorderColor(), BorderStrokeStyle.SOLID, new CornerRadii(PREFERRED_WIDTH * 0.025), new BorderWidths(tile.getBorderWidth()))));
pane.setBackground(new Background(new BackgroundFill(tile.getBackgroundColor(), new CornerRadii(PREFERRED_WIDTH * 0.025), Insets.EMPTY)));
getChildren().setAll(pane);
}
Aggregations