write shit successfully

This commit is contained in:
2021-05-22 13:25:37 +08:00
parent 4aacc76a49
commit fc3e3906bc
8 changed files with 99 additions and 17 deletions

View File

@ -86,6 +86,43 @@ namespace BallanceTASEditor {
ChangeToolMode(ToolMode.Overwrite);
}
// move btn
private void funcBtn_FastMovePrev(object sender, RoutedEventArgs e) {
MoveSliderManually(true, true);
}
private void funcBtn_MovePrev(object sender, RoutedEventArgs e) {
MoveSliderManually(true, false);
}
private void funcBtn_MoveNext(object sender, RoutedEventArgs e) {
MoveSliderManually(false, false);
}
private void funcBtn_FastMoveNext(object sender, RoutedEventArgs e) {
MoveSliderManually(false, true);
}
// move keyboard
private void funcWindow_KeyUp(object sender, KeyEventArgs e) {
switch(e.Key) {
case Key.A:
MoveSliderManually(true, true);
break;
case Key.S:
MoveSliderManually(true, false);
break;
case Key.D:
MoveSliderManually(false, false);
break;
case Key.F:
MoveSliderManually(false, true);
break;
}
}
#endregion
@ -151,5 +188,10 @@ namespace BallanceTASEditor {
}
}
private void MoveSliderManually(bool isPrev, bool isFast) {
var step = isFast ? mViewer.GetItemCountInPage() : 1;
uiTASSlider.Value = Util.Clamp(uiTASSlider.Value.ToInt32() + (isPrev ? -1 : 1) * step, uiTASSlider.Minimum.ToInt32(), uiTASSlider.Maximum.ToInt32());
}
}
}