Adjusted message rendering

This commit is contained in:
DieGurke 2020-07-22 00:03:12 +02:00
parent 49ecba6c23
commit 5258a7dc12
3 changed files with 6 additions and 4 deletions

View File

@ -36,7 +36,7 @@ import envoy.util.EnvoyLog;
*
* @author Leon Hofmeister
* @author Maximilian Käfer
* @since Envoy Client v0.2-beta
* @since Envoy Client v0.1-beta
*/
public class MessageControl extends Label {

View File

@ -30,8 +30,10 @@ public final class MessageListCell extends AbstractListCell<Message, MessageCont
final var control = new MessageControl(message);
listView.widthProperty()
.addListener((observable, oldValue, newValue) -> {
int padding = Math.min(100, newValue.intValue() / 10);
setPadding(new Insets(0, padding, 0, padding));
int padding = 0;
if (newValue.intValue() > 1020) padding = (newValue.intValue() - 1000) / 2;
else padding = 10;
setPadding(new Insets(0, padding, 6, padding));
});
if (control.isOwnMessage()) setAlignment(Pos.CENTER_RIGHT);
else setAlignment(Pos.CENTER_LEFT);