Skip to content

Commit

Permalink
TweetWallFX#1283 Add option for circular profile image, defaults to true
Browse files Browse the repository at this point in the history
  • Loading branch information
svenreimers committed Oct 10, 2022
1 parent 034918c commit f51b458
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Rectangle;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
Expand Down Expand Up @@ -179,10 +180,15 @@ private Pane createSessionNode(final MachineContext context, final SessionData s
})
.peek(img -> {
// avatar image clipping
Rectangle clip = new Rectangle(config.avatarSize, config.avatarSize);
clip.setArcWidth(config.avatarArcSize);
clip.setArcHeight(config.avatarArcSize);
img.setClip(clip);
if (config.circularAvatar) {
Circle circle = new Circle(config.avatarSize/2f, config.avatarSize/2f, config.avatarSize/2f);
img.setClip(circle);
} else {
Rectangle clip = new Rectangle(config.avatarSize, config.avatarSize);
clip.setArcWidth(config.avatarArcSize);
clip.setArcHeight(config.avatarArcSize);
img.setClip(clip);
}
})
.toArray(Node[]::new)
);
Expand Down Expand Up @@ -281,5 +287,6 @@ public static class Config extends AbstractConfig {
public double sessionHGap = 10;
public double sessionHeight = 200;
public boolean showTrackAvatar = true;
public boolean circularAvatar = true;
}
}

0 comments on commit f51b458

Please sign in to comment.