Re: ScrollViewer Custom Manipulation issues
Posted: 31 Jan 2023, 09:36
Hello, I am a colleague of CornNieu and am picking up where they left off.
For context, we are using Noesis 3.0.12.
We aren't receiving any calls to neither OnManipulationInertiaStarting nor OnManipulationDelta and I'm wondering if we've set up the OnManipulationStarted function incorrectly.
By "override OnManipulationStarted to capture the touch while dragging" I can only assume that you mean to call the CaptureTouch() function. The problem is that it's not doing anything. I can't seem to find any resources on how to receive the touch device ID for the manipulation event, but since we're testing on Windows right now I guess I can just pass 0 for now.
I've looked at the sample code in the Touch tutorial but it feels like the use case is very different from ours since we are overriding the behavior of a scroll viewer and not trying to implement manipulation on something that didn't already have it.
It's also unclear if I should call the super ParentClass::OnManipulationXXX() functions or not, but doing either has no effect on the app. Even overriding all of the manipulation functions and emptying them of any logic still leaves the scroll viewer fully functional, which is very suspicious to me.
This is the code we have so far:
For context, we are using Noesis 3.0.12.
We aren't receiving any calls to neither OnManipulationInertiaStarting nor OnManipulationDelta and I'm wondering if we've set up the OnManipulationStarted function incorrectly.
By "override OnManipulationStarted to capture the touch while dragging" I can only assume that you mean to call the CaptureTouch() function. The problem is that it's not doing anything. I can't seem to find any resources on how to receive the touch device ID for the manipulation event, but since we're testing on Windows right now I guess I can just pass 0 for now.
I've looked at the sample code in the Touch tutorial but it feels like the use case is very different from ours since we are overriding the behavior of a scroll viewer and not trying to implement manipulation on something that didn't already have it.
It's also unclear if I should call the super ParentClass::OnManipulationXXX() functions or not, but doing either has no effect on the app. Even overriding all of the manipulation functions and emptying them of any logic still leaves the scroll viewer fully functional, which is very suspicious to me.
This is the code we have so far:
Code: Select all
CustomScrollViewer::CustomScrollViewer()
{
SetIsManipulationEnabled(true);
}
void CustomScrollViewer::OnManipulationStarting(const Noesis::ManipulationStartingEventArgs& e)
{
e.handled = true;
e.manipulationContainer = this;
e.mode = Noesis::ManipulationModes_TranslateX;
ParentClass::OnManipulationStarting(e);
}
void CustomScrollViewer::OnManipulationStarted(const Noesis::ManipulationStartedEventArgs& e)
{
e.handled = true;
CaptureTouch(0);
ParentClass::OnManipulationStarted(e);
}
void CustomScrollViewer::OnManipulationInertiaStarting(const Noesis::ManipulationInertiaStartingEventArgs& e)
{
e.handled = true;
ReleaseTouchCapture(0);
ParentClass::OnManipulationInertiaStarting(e);
}
void CustomScrollViewer::OnManipulationDelta(const Noesis::ManipulationDeltaEventArgs& e)
{
e.handled = true;
// ...
ParentClass::OnManipulationDelta(e);
}
void CustomScrollViewer::OnManipulationCompleted(const Noesis::ManipulationCompletedEventArgs& e)
{
e.handled = true;
ParentClass::OnManipulationCompleted(e);
}