mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-04-22 18:46:53 -04:00
add double click on titleBar to min/maximize application
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
package org.cryptomator.ui.mainwindow;
|
||||
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.binding.BooleanBinding;
|
||||
import javafx.beans.property.ReadOnlyBooleanProperty;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.input.MouseButton;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.stage.Stage;
|
||||
import org.cryptomator.common.LicenseHolder;
|
||||
import org.cryptomator.common.settings.Settings;
|
||||
import org.cryptomator.ui.common.FxController;
|
||||
@@ -12,12 +19,6 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.binding.BooleanBinding;
|
||||
import javafx.beans.property.ReadOnlyBooleanProperty;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
@MainWindowScoped
|
||||
public class MainWindowTitleController implements FxController {
|
||||
@@ -58,6 +59,18 @@ public class MainWindowTitleController implements FxController {
|
||||
titleBar.setOnMousePressed(event -> {
|
||||
xOffset = event.getSceneX();
|
||||
yOffset = event.getSceneY();
|
||||
|
||||
});
|
||||
titleBar.setOnMouseClicked(event -> {
|
||||
if (event.getButton().equals(MouseButton.PRIMARY)) {
|
||||
if (event.getClickCount() == 2) {
|
||||
if (window.isFullScreen()) {
|
||||
window.setFullScreen(false);
|
||||
} else {
|
||||
window.setFullScreen(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
titleBar.setOnMouseDragged(event -> {
|
||||
window.setX(event.getScreenX() - xOffset);
|
||||
|
||||
Reference in New Issue
Block a user