please help me track down this (WPF) zoom bug

Oystein Bjorke 4 years ago 0
This discussion was imported from CodePlex

brantheman wrote at 2012-06-05 19:37:

I'm trying to track down a zoom issue. Steps to repeat the issue:

1. Open the OxyPlot.Wpf solution.

2. Set the WpfExamples project as the startup project.

3. Modify WpfExamples.Examples.BarSeriesDemo.MainWindow.xaml.cs to look like this:

tmp.Axes.Add(new CategoryAxis { ItemsSource = Items, LabelField = "Label", AbsoluteMinimum = 0, AbsoluteMaximum = Items.Count, IsPanEnabled = true, IsZoomEnabled = true});tmp.Axes.Add(new LinearAxis(AxisPosition.Left) { MinimumPadding = 0, AbsoluteMinimum = 0, IsZoomEnabled = false, IsPanEnabled = false});

4. Fire up the BarSeries demo and zoom in and out. Give that mouse wheel a good strong spin and watch as you zoom to outer space, which wasn't expected given the axes' parameters noted above.

It's almost like the flip of a switch. I can even get it into a situation where a single click on the mouse wheel jumps the zoom/pan out of any viewable content.


objo wrote at 2012-06-19 12:41:

thanks for the bug report - will look into this later!


objo wrote at 2012-06-27 15:52:

I could not reproduce this. It works fine here.

I changed AbsoluteMinimum=-0.5 and AbsoluteMaximum=Items.Count-0.5 in order to get the CategoryAxis to look right (the AbsoluteMinimum/Maximum are not checked before the user tries to zoom/pan).

My code currently looks like this:

            tmp.Axes.Add(new CategoryAxis
            {
                ItemsSource = this.Items,
                LabelField = "Label",
                AbsoluteMinimum = -0.5,
                AbsoluteMaximum = this.Items.Count - 0.5,
                IsPanEnabled = true,
                IsZoomEnabled = true
            });

            tmp.Axes.Add(new LinearAxis(AxisPosition.Left)
                {
                    MinimumPadding = 0,
                    AbsoluteMinimum = 0,
                    IsZoomEnabled = false,
                    IsPanEnabled = false
                });

brantheman wrote at 2012-06-27 22:09:

This bug definitely still exists. I'm using a Microsoft mouse with a fairly recent version of Intellipoint. Normal mouse wheel behavior doesn't show the problem. You have to spin the wheel really fast for the problem to occur.


objo wrote at 2012-06-28 06:31:

Ok, I submitted a change that might help - can you verify? I still could not zoom fast enough to reproduce this error (I have an old Logitech G3 mouse with standard Windows 7 HID driver).

If it is still a problem, can you create a log of the Delta values from the MouseWheelEventArgs?


brantheman wrote at 2012-06-29 17:25:

Yes, that change fixes it. Thank you! As a second note, it appears that you're not setting the Handled property on the various mouse events for WPF when you use the event. Nor do you check it before using the event. Do you think that might help?

For the record, I did make a log of my delta values:

-120, -120, -240, -360, -360, -131, -131, -394, -262, -171, -514, -514, -514, -514, 120, 600, 600, 360, 240, -120, -240, -360, -120, -120, -131, -394, -394, -394, -394, -262, -171, -514, -514, -514, 120, 600, 240, 144, 722, 722, 433, 433, -120, -360, -360, -360, -360, -480, -131, -394, -394, -525, -171, -514, -686, -514, -686, -514, -686, -514, -202, -606, -809, -606, -809, -606, -606, -227, -908, -681, -908, -681, -247, -743, -1983, -1487, -991, -1487, -991, -743, -265, -797, -1063, -797, -797, -281, -844, -1126, -844, -2253, -844, -1126, -844, -1126, -295, -887, -1182, -887, -1182, -887, -308, -616, -925, -925, -2466, -925, -925, -319, -1279, -959, -1279, -959, -1279, -959, -330, -991, -2644, -991, -2644, -991, -1322, -340, -1361, -1020, -2722, -2041, -1361, -1020, -1361, -1020, -349, -2096, -4193, -2096, -2096, -1397, -1048, -1397, -357, -2863, -2147, -2863, -2147, -1431, -2147, -1073, -365, -1097, -2927, -5122, -2195, -1463, -1097, -1463, -373, -2240, -5227, -2240, -2987, -1120, -1120, -380, -1141, -3044, -2283, -3044, -2283, -3044, -1141, -1522, -1141, -387, -1162, -3098, -6972, -2324, -1549, -1162, -1549, -1162, -393, -1181, -1181, -1575, 120, 1440, 1200, 2160, 600, 1440, 600, 600, 288, 1733, 1444, 866, 722, 866, 188, 1132, 1887, 2265, 943, 222, 1335, 1112, 1335, 2225, 1335, 1112, 249, 1249, 1249, 2498, 1249, 272, 1636, 1363, 1636, 1363, -240, -1320, -360, -480, -360, -480, -131, -394, -1050, -788, -1050, -394, -525, -394, -394, -171, -686, -514, -1372, -1029, -686, -514, -686, -202, -606, -1213, -1618, -1213, -809, -606, -809, -606, -227, -681, -1816, -1362, -1816, -1362, -681, -908, -681, 120, 1200, 1440, 600, 720, 360, 144, 866, 722, 1733, 722, 722, 377, 1887, 1132, 943, 222, 1112, 2670, 1112, 1335, 1112, 1112, 249, 2997, 2498, 1498, 1249, 272, 1363, 3272, 2727, 1363, 1636, 1363, 584, 2924, 3509, 1462, 1462, -120, -720, -480, -360, 120, 720, 1200, 1440, 600, 720, -120, -960, -720, -480, -360, 120, 1440, 1200, 720, 600, -240, -960, -720, -480, -360, -480, -262, -525, -788, -1050, -788, -525, -394, -525, -171, -1029, -686, -514, -686, -202, -809, -1213, -1618, -606, -809, -606, -809, -227, -1816, -1362, -1816, -1362, -908, -1362, -681, -247, -991, -1487, -1983, -1487, -1983, -743, -991, -743, -265, -797, -3722, -1063, -1595, -1063, -797, -563, -3942, -1689, -1126, -1689, -844, -295, -1774, -2365, -2661, -2365, -887, -1182, -887, -308, -2466, -4316, -925, -2466, -925, -319, -1919, -1279, -1919, -1919, -1279, -959, -1279, -330, -1983, -5618, -2644, -991, -1322, -991, -1322, -340, -2041, -2722, -2041, -2722, -3062, -1020, -349, -2096, -4193, -2096, -1397, -1048, -2445, -357, -2147, -2863, -2147, -2863, -1073, -1431, -1073


objo wrote at 2012-07-11 00:27:

Thanks for the notice about the missing checks of the Handled property. I added the checks now (WPF control only), I hope I got it right. 

CodePlex