Skip to content
This repository was archived by the owner on Mar 26, 2019. It is now read-only.

Commit 5f2effd

Browse files
committed
完成一个TODO:用户删减字符时,重置被删除的字符的样式。
1 parent 60477fb commit 5f2effd

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/main/java/me/ryan/controller/TextController.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,12 @@ private void updateText() {
150150
// 相等的话,就不需要更新任何东西。打中文会有这种情况
151151
return;
152152
} else {
153-
// TODO 删减了字符,需要重置被删除的字符的显示状态。
154-
}
155-
156-
// 用户在跟打过程中删除了已经输入的所有内容,这时要调用重打方法
157-
// 但是调用start前,要先恢复文章显示框的所有字符的样式,所以它要放这下面。
158-
if (inputLengthNow == 0 && inputLengthLast > 0) {
159-
this.start();
153+
// 删减了字符,需要重置被删除的字符的显示状态。
154+
for (int i = inputLengthNow; i < inputLengthLast; i++) {
155+
var text = (Text) textList.get(i);
156+
text.setOpacity(1);
157+
text.setFill(Paint.valueOf("Black"));
158+
}
160159
}
161160

162161

0 commit comments

Comments
 (0)