增加画板亮度设置
This commit is contained in:
parent
56913b9acc
commit
76c55ebb6f
|
@ -1,7 +1,8 @@
|
|||
{
|
||||
"shape": {
|
||||
"basic": {
|
||||
"autoStart": true
|
||||
"autoStart": true,
|
||||
"drawingBoardOpacity": 0.1
|
||||
},
|
||||
"brush": {
|
||||
"transparent": false,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.rococy.roomit.control;
|
||||
|
||||
import javafx.scene.control.Slider;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
|
||||
/**
|
||||
* 滑动条
|
||||
|
@ -21,7 +22,7 @@ public class RoomItSlider extends Slider {
|
|||
|
||||
private void initEvents() {
|
||||
// 使滑动块按步数走
|
||||
this.setOnMouseReleased(e -> this.setValue(Math.round(this.getValue())));
|
||||
this.addEventHandler(MouseEvent.MOUSE_RELEASED, e -> this.setValue(Math.round(this.getValue())));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -89,6 +89,9 @@ public class MainWindowController extends BaseController implements Initializabl
|
|||
*/
|
||||
private final ColorPicker colorPicker = new ColorPicker();
|
||||
|
||||
/**
|
||||
* 文件配置
|
||||
*/
|
||||
private final KeyBoardConfiguration keyBoardConfiguration = ConfigurationManager.getKeyboardConfiguration();
|
||||
|
||||
@FXML
|
||||
|
@ -177,11 +180,12 @@ public class MainWindowController extends BaseController implements Initializabl
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 初始化最外层的pane
|
||||
*/
|
||||
private void initPaneWrapper() {
|
||||
// 设置透明度
|
||||
container.setStyle("-fx-background-color: rgba(0,0,0," + ConfigurationManager.getBasicConfiguration().getDrawingBoardOpacity() + ")");
|
||||
// 设置宽高
|
||||
container.setPrefSize(ScreenUtils.getScreenWidth(), ScreenUtils.getScreenWidth());
|
||||
// 弹出提示消息
|
||||
|
@ -198,7 +202,6 @@ public class MainWindowController extends BaseController implements Initializabl
|
|||
container.addEventHandler(MouseEvent.MOUSE_DRAGGED, paneMouseEventHandler);
|
||||
container.addEventHandler(MouseEvent.MOUSE_ENTERED, paneMouseEventHandler);
|
||||
container.addEventHandler(MouseEvent.MOUSE_MOVED, paneMouseEventHandler);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -92,11 +92,17 @@ public class SettingWindowController {
|
|||
* 是否开机自启
|
||||
*/
|
||||
@FXML
|
||||
private ToggleGroup selfStartingGroup;
|
||||
private ToggleGroup autoStartGroup;
|
||||
@FXML
|
||||
private RadioButton selfStartingBtn;
|
||||
private RadioButton autoStartBtn;
|
||||
@FXML
|
||||
private RadioButton notSelfStartingBtn;
|
||||
private RadioButton notAutoStartBtn;
|
||||
|
||||
/**
|
||||
* 画板亮度
|
||||
*/
|
||||
@FXML
|
||||
private RoomItSlider drawingBoardOpacitySlider;
|
||||
|
||||
/**
|
||||
* 快捷键
|
||||
|
@ -202,11 +208,20 @@ public class SettingWindowController {
|
|||
|
||||
private void initConfigurationListener() {
|
||||
// 是否开机自启
|
||||
selfStartingGroup.selectedToggleProperty()
|
||||
autoStartGroup.selectedToggleProperty()
|
||||
.addListener((observable, oldValue, newValue) -> {
|
||||
basicConfiguration.setAutoStart(Boolean.parseBoolean((String) newValue.getUserData()));
|
||||
AutoStartFile.toggleExists();
|
||||
});
|
||||
// 画板亮度
|
||||
drawingBoardOpacitySlider.valueProperty()
|
||||
.addListener((observable, oldValue, newValue) -> {
|
||||
int val = (int) Math.round(newValue.doubleValue());
|
||||
// 10转成0
|
||||
double opacity = Double.parseDouble("0." + (10 - val));
|
||||
basicConfiguration.setDrawingBoardOpacity(opacity);
|
||||
});
|
||||
|
||||
// 是否透明
|
||||
transparentGroup.selectedToggleProperty()
|
||||
.addListener((observable, oldValue, newValue) -> brushConfiguration.setTransparent(Boolean.parseBoolean((String) newValue.getUserData())));
|
||||
|
@ -232,10 +247,14 @@ public class SettingWindowController {
|
|||
private void initBasicConfiguration() {
|
||||
// 是否开机自启
|
||||
if (basicConfiguration.getAutoStart()) {
|
||||
selfStartingBtn.setSelected(true);
|
||||
autoStartBtn.setSelected(true);
|
||||
} else {
|
||||
notSelfStartingBtn.setSelected(true);
|
||||
notAutoStartBtn.setSelected(true);
|
||||
}
|
||||
|
||||
// 0转成10
|
||||
int val = (int) (10 - Double.parseDouble((basicConfiguration.getDrawingBoardOpacity() + "").substring(2, 3)));
|
||||
drawingBoardOpacitySlider.setValue(val);
|
||||
}
|
||||
|
||||
private void initBrushConfiguration() {
|
||||
|
|
|
@ -7,6 +7,15 @@ package org.rococy.roomit.domain;
|
|||
public class BasicConfiguration {
|
||||
|
||||
private Boolean autoStart;
|
||||
private Double drawingBoardOpacity;
|
||||
|
||||
public Double getDrawingBoardOpacity() {
|
||||
return drawingBoardOpacity == 0.0 ? 0.05 : drawingBoardOpacity;
|
||||
}
|
||||
|
||||
public void setDrawingBoardOpacity(Double drawingBoardOpacity) {
|
||||
this.drawingBoardOpacity = drawingBoardOpacity;
|
||||
}
|
||||
|
||||
public Boolean getAutoStart() {
|
||||
return autoStart;
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
#container {
|
||||
-fx-background-color: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
/* color-picker的按钮隐藏 */
|
||||
.button {
|
||||
visibility: false;
|
||||
|
|
|
@ -29,17 +29,24 @@
|
|||
<VBox userData="0" style="-fx-spacing: 8px">
|
||||
<Label styleClass="h1">基础</Label>
|
||||
<VBox style="-fx-spacing: 15px">
|
||||
<!-- 开机自启 -->
|
||||
<VBox>
|
||||
<VBox style="-fx-spacing: 15px">
|
||||
<!-- 开机自启 -->
|
||||
<HBox style="-fx-spacing: 10px">
|
||||
<Label>开机自启:</Label>
|
||||
<fx:define>
|
||||
<ToggleGroup fx:id="selfStartingGroup"/>
|
||||
<ToggleGroup fx:id="autoStartGroup"/>
|
||||
</fx:define>
|
||||
<RadioButton fx:id="selfStartingBtn" text="是" userData="true"
|
||||
toggleGroup="$selfStartingGroup" selected="true"/>
|
||||
<RadioButton fx:id="notSelfStartingBtn" text="否" userData="false"
|
||||
toggleGroup="$selfStartingGroup"/>
|
||||
<RadioButton fx:id="autoStartBtn" text="是" userData="true"
|
||||
toggleGroup="$autoStartGroup" selected="true"/>
|
||||
<RadioButton fx:id="notAutoStartBtn" text="否" userData="false"
|
||||
toggleGroup="$autoStartGroup"/>
|
||||
</HBox>
|
||||
|
||||
<!-- 画板亮度 -->
|
||||
<HBox style="-fx-spacing: 10px">
|
||||
<Label style="-fx-padding: 0px 0">画板亮度:</Label>
|
||||
<RoomItSlider fx:id="drawingBoardOpacitySlider" styleClass="jfx-slider" min="1" max="10"
|
||||
blockIncrement="1"/>
|
||||
</HBox>
|
||||
</VBox>
|
||||
</VBox>
|
||||
|
|
Loading…
Reference in New Issue