mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-04-24 08:31:39 -04:00
Platform sync fixes
This commit is contained in:
@@ -4,6 +4,7 @@ import io.xpipe.app.fxcomps.Comp;
|
||||
import io.xpipe.app.fxcomps.CompStructure;
|
||||
import io.xpipe.app.fxcomps.SimpleCompStructure;
|
||||
|
||||
import io.xpipe.app.fxcomps.util.PlatformThread;
|
||||
import javafx.beans.property.ObjectProperty;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
@@ -46,7 +47,7 @@ public class ButtonComp extends Comp<CompStructure<Button>> {
|
||||
public CompStructure<Button> createBase() {
|
||||
var button = new Button(null);
|
||||
if (name != null) {
|
||||
button.textProperty().bind(name);
|
||||
button.textProperty().bind(PlatformThread.sync(name));
|
||||
}
|
||||
var graphic = getGraphic();
|
||||
if (graphic instanceof FontIcon f) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import io.xpipe.app.fxcomps.augment.Augment;
|
||||
import io.xpipe.app.fxcomps.augment.GrowAugment;
|
||||
import io.xpipe.app.fxcomps.impl.TooltipAugment;
|
||||
import io.xpipe.app.fxcomps.util.BindingsHelper;
|
||||
import io.xpipe.app.fxcomps.util.PlatformThread;
|
||||
import io.xpipe.app.fxcomps.util.Shortcuts;
|
||||
|
||||
import javafx.application.Platform;
|
||||
@@ -148,13 +149,15 @@ public abstract class Comp<S extends CompStructure<?>> {
|
||||
var region = struc.get();
|
||||
BindingsHelper.preserve(region, o);
|
||||
o.subscribe(n -> {
|
||||
if (!n) {
|
||||
region.setVisible(true);
|
||||
region.setManaged(true);
|
||||
} else {
|
||||
region.setVisible(false);
|
||||
region.setManaged(false);
|
||||
}
|
||||
PlatformThread.runLaterIfNeeded(() -> {
|
||||
if (!n) {
|
||||
region.setVisible(true);
|
||||
region.setManaged(true);
|
||||
} else {
|
||||
region.setVisible(false);
|
||||
region.setManaged(false);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user