Revision | a4a4d0b03ca44d3b4119a0908794fc6534b8f8ba (tree) |
---|---|
Time | 2013-10-24 10:11:10 |
Author | HMML <hmml3939@gmai...> |
Commiter | HMML |
Improve marker tracking.
@@ -28,6 +28,7 @@ namespace MMM_GraphEditor | ||
28 | 28 | private GraphPanel _panel_inner; |
29 | 29 | private GraphPanel _panel_outer; |
30 | 30 | private GraphEditorControl _main_control; |
31 | + public int center_marker_padding = 36; | |
31 | 32 | |
32 | 33 | protected override void OnMouseWheel(MouseEventArgs e) |
33 | 34 | { |
@@ -260,7 +261,18 @@ namespace MMM_GraphEditor | ||
260 | 261 | { |
261 | 262 | if (scene == null) return; |
262 | 263 | if (PanelOuter == null) return; |
263 | - PanelOuter.AutoScrollPosition = new Point((int)(scene.MarkerPosition * frame_width - PanelOuter.Width / 2), 0); | |
264 | + | |
265 | + int cur = -PanelOuter.AutoScrollPosition.X; | |
266 | + if (scene.MarkerPosition * frame_width - center_marker_padding < cur) | |
267 | + { | |
268 | + PanelOuter.AutoScrollPosition = new Point((int)(scene.MarkerPosition * frame_width - center_marker_padding), 0); | |
269 | + return; | |
270 | + } | |
271 | + if (scene.MarkerPosition * frame_width + center_marker_padding > cur + PanelOuter.Width) | |
272 | + { | |
273 | + PanelOuter.AutoScrollPosition = new Point((int)(scene.MarkerPosition * frame_width - PanelOuter.Width + center_marker_padding), 0); | |
274 | + return; | |
275 | + } | |
264 | 276 | } |
265 | 277 | |
266 | 278 | public void centerMarkerVirtical() |