diff options
| author | Avi Levkovich <avi@twine-s.com> | 2018-04-09 14:25:30 +0300 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2018-04-09 14:25:30 +0300 |
| commit | e8e2f174cc7dc1e6c183e855834982d12e92833c (patch) | |
| tree | ea8c5358d7e6928c513814c8619339f0c6790840 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Controls/TimelineScrollViewer.cs | |
| parent | f19e2e305d8baeafc30dde4fc0aa3fa37038869c (diff) | |
| parent | c1ed75027f069e204e52e48bfb610d2d225bbd72 (diff) | |
| download | Tango-e8e2f174cc7dc1e6c183e855834982d12e92833c.tar.gz Tango-e8e2f174cc7dc1e6c183e855834982d12e92833c.zip | |
mERGE
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Controls/TimelineScrollViewer.cs')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Controls/TimelineScrollViewer.cs | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Controls/TimelineScrollViewer.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Controls/TimelineScrollViewer.cs new file mode 100644 index 000000000..dd1227a06 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Controls/TimelineScrollViewer.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Controls; +using System.Windows.Input; + +namespace Tango.MachineStudio.Logging.Controls +{ + public class TimelineScrollViewer : ScrollViewer + { + public event EventHandler<MouseWheelEventArgs> MouseZooming; + + protected override void OnMouseWheel(MouseWheelEventArgs e) + { + if (Keyboard.IsKeyDown(Key.LeftCtrl)) + { + e.Handled = true; + OnMouseZooming(e); + } + else + { + base.OnMouseWheel(e); + } + + e.Handled = false; + } + + protected override void OnKeyDown(KeyEventArgs e) + { + if (e.KeyboardDevice.Modifiers == ModifierKeys.Control) + { + if (e.Key == Key.Left || e.Key == Key.Right) + e.Handled = true; + return; + } + base.OnKeyDown(e); + } + + protected override void OnPreviewKeyDown(KeyEventArgs e) + { + e.Handled = true; + } + + protected virtual void OnMouseZooming(MouseWheelEventArgs e) + { + if (MouseZooming != null) MouseZooming(this, e); + } + } +} |
