Browse Source

Fixed scale element

flabbet 1 year ago
parent
commit
fb5d4a89fa
1 changed files with 4 additions and 2 deletions
  1. 4 2
      src/PixiEditor.AvaloniaUI/Views/Animations/Timeline.cs

+ 4 - 2
src/PixiEditor.AvaloniaUI/Views/Animations/Timeline.cs

@@ -18,6 +18,8 @@ namespace PixiEditor.AvaloniaUI.Views.Animations;
 [TemplatePart("PART_TimelineHeaderScroll", typeof(ScrollViewer))]
 [TemplatePart("PART_TimelineHeaderScroll", typeof(ScrollViewer))]
 internal class Timeline : TemplatedControl
 internal class Timeline : TemplatedControl
 {
 {
+    private const float MarginMultiplier = 1.5f;
+    
     public static readonly StyledProperty<KeyFrameCollection> KeyFramesProperty =
     public static readonly StyledProperty<KeyFrameCollection> KeyFramesProperty =
         AvaloniaProperty.Register<Timeline, KeyFrameCollection>(
         AvaloniaProperty.Register<Timeline, KeyFrameCollection>(
             nameof(KeyFrames));
             nameof(KeyFrames));
@@ -250,9 +252,9 @@ internal class Timeline : TemplatedControl
         double currentFrameUnderMouse = towardsFrame;
         double currentFrameUnderMouse = towardsFrame;
         double newOffsetX = currentFrameUnderMouse * newScale - mouseXInViewport + MinLeftOffset;
         double newOffsetX = currentFrameUnderMouse * newScale - mouseXInViewport + MinLeftOffset;
 
 
-        if (towardsFrame * 1.5f > KeyFrames.FrameCount)
+        if (towardsFrame * MarginMultiplier > KeyFrames.FrameCount)
         {
         {
-            extendingElement.Margin = new Thickness(newOffsetX * 1.25f, 0, 0, 0);
+            extendingElement.Margin = new Thickness(newOffsetX * 50, 0, 0, 0);
         }
         }
         else
         else
         {
         {