I have a problem with dynamically adding/removing zoom/pan modifier.
Initially when chart is created, it add zoomExtend and xyRubberBand modifier, so the chart zooms on left button drag. I added a button in my app so when the button is clicked, xyRubberBand is removed and ZoomPan modifier is added (with execute on MouseLeftButton); so when I click button, I do see pan behavior, problem is, when mouse left button up it still stays in pan mode, which means pan continues even with left button up, I found if I click right mouse button at this point the pan behavior stops.
The code to dynamically add/remove modifiers is below
public void AddPan()
{
var rubber = ModifierGroup.ChildModifiers.FirstOrDefault(x => x is RubberBandXyZoomModifier);
var pan = ModifierGroup.ChildModifiers.FirstOrDefault(x => x is ZoomPanModifier);
if (rubber != null) ModifierGroup.ChildModifiers.Remove(rubber);
if (pan == null) ModifierGroup.ChildModifiers.Add(new ZoomPanModifier() { ExecuteOn = ExecuteOn.MouseLeftButton, IsEnabled =
true });
OnPropertyChanged(nameof(ModifierGroup));
}
- sally an asked 4 years ago
-
I found the issue – the modifier needs to be inserted to top of the modifier group childmodifiers, thanks.
-
Hi Sally, Thanks for your inquiry. I am glad you’ve found the solution! If you have any further questions please feel free to ask. With best regards, Oleksandr
- You must login to post comments
Please login first to submit.