Skip to content

Commit

Permalink
Add snapping and fix glitchy movement at bottom
Browse files Browse the repository at this point in the history
  • Loading branch information
IntelOrca committed Sep 1, 2024
1 parent 7cf91a0 commit c71f622
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/emdui/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,9 @@ public void SetEntity(int i, int t, double value)
return;

var denormalizedValue = (Wrap(value - 1) + 1) / 2;
var rawValue = (short)((int)(denormalizedValue * 4096) % 4096);
var rawValue = value <= -1
? (short)(2049)
: (short)((int)(denormalizedValue * 4096) % 4096);

var v = frame.Angles[i / 3];
if (iC == 0) v.x = rawValue;
Expand Down
10 changes: 10 additions & 0 deletions src/emdui/Ui/Animation/TimelineSeries.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ protected override void OnPreviewMouseDown(MouseButtonEventArgs e)

protected override void OnPreviewMouseMove(MouseEventArgs e)
{
if (e.LeftButton == MouseButtonState.Released)
{
_grabbedPoint = null;
}

if (_grabbedPoint != null)
{
var time = _grabbedPoint.Time;
Expand All @@ -145,6 +150,11 @@ protected override void OnPreviewMouseMove(MouseEventArgs e)
new Vector(_grabbedPoint.Width / 2, _grabbedPoint.Height / 2);
var oldValue = _points[time];
var newValue = YToValue(newPoint.Y);
if ((Keyboard.Modifiers & ModifierKeys.Control) != 0)
{
newValue = Math.Round(newValue / 0.25) * 0.25;
}

_grabbedPoint.Value = newValue;
_points[time] = newValue;
Refresh();
Expand Down

0 comments on commit c71f622

Please sign in to comment.