aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/MainView.xaml.cs
blob: c8d232e86410614bd5d01f1db6dab482a7caac19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Tango.MachineStudio.Logging.Views
{
    /// <summary>
    /// Interaction logic for MainView.xaml
    /// </summary>
    public partial class MainView : UserControl
    {
        public static MainView Instance { get; private set; }

        public MainView()
        {
            InitializeComponent();
            Instance = this;
        }
    }
}
> -- no-op but we still want j/k to walk the cursor if cursor_at_boundary() then return end local win_height = vim.api.nvim_win_get_height(0) local duration, sleep_duration = 100, 16 -- 60 fps local distance = math.floor(win_height / 2) -- We want a movement every `sleep_duration` msec local steps_number = math.ceil(duration / sleep_duration) local step = distance / steps_number local scroll_keys = dir == Dir.DOWN and "\\<C-e>j" or "\\<C-y>k" local cursor_keys = dir == Dir.DOWN and "j" or "k" local prev = 0 for i = 1, steps_number do local cur = math.ceil(step * i) local delta = cur - prev prev = cur vim.defer_fn(function() for _ = 1, delta do if cursor_at_boundary() then return end -- past the viewport boundary <C-e>/<C-y> no-op; just walk the cursor local keys = scroll_at_boundary() and cursor_keys or scroll_keys vim.cmd('exec "normal! ' .. keys .. '"') end end, sleep_duration * i) end end local function smooth_scroll_up() smooth_scroll(Dir.UP) end local function smooth_scroll_down() smooth_scroll(Dir.DOWN) end ---------------------------------------------------------------------------------------------------- vim.api.nvim_create_user_command( "ScrollSmoothDown", smooth_scroll_down, { desc = "Scroll down smoothly" } ) vim.api.nvim_create_user_command( "ScrollSmoothUp", smooth_scroll_up, { desc = "Scroll up smoothly" } )