0

I am writing an app which is using the InkCanvas in UWP. In my App, I do enable double touch gesture to pan and zoom and single touch to ink. To do that I disable IsInputEnabled when I detect multi-touch. The code to do that looks something like this

InkManager.Element.InkPresenter.UnprocessedInput.PointerEntered += 
delegate (InkUnprocessedInput sender, PointerEventArgs args)
{
    if (args.CurrentPoint.PointerDevice.PointerDeviceType == PointerDeviceType.Touch)
    {
        _numContacts++;
        if (_numContacts == 2)
        {
            InkManager.Element.InkPresenter.IsInputEnabled = false;
        }
    }
 };

I then re-enable IsInputEnabled after the view manipulation.

Everything works fine, except for the ruler.

 InkPresenterRuler Ruler = new InkPresenterRuler(InkManager.Element.InkPresenter)
 {
     Length = _container.Width
 };

If I have a InkPresenterRuler attached to the canvas, then the ruler can't be moved anymore until I do add at least one stroke to the canvas. It looks like when I disable the input on the fly, the inking in progress got successfully aborted on the InkPresenter, but remained suspended on the attached ruler, until the following input got processed. The same problem apply to the InkPresenterProtractor.

I can't find any method (on the ruler or the canvas), which allow me to completely clean up the pending event, to make the ruler work properly programmatically.

Anyone working with InkCanvas on UWP that has a suggestion on how to solve this?

Thanks!!

ClaudiaWey
  • 167
  • 9
  • Could you create a simple sample to reproduce it here so that I can look into the issue? – Breeze Liu - MSFT Aug 13 '18 at 03:08
  • @BreezeLiu-MSFT Absolutely! – ClaudiaWey Aug 15 '18 at 00:42
  • Here the link to the .xaml file https://1drv.ms/u/s!AhXT8x-JilqWhfh7Pko7iPN7hNcI8w and the .cs file https://1drv.ms/u/s!AhXT8x-JilqWhfh9uuLqE2LMB7uj2Q – ClaudiaWey Aug 15 '18 at 00:52
  • I uploaded also the entire simple project sample here https://1drv.ms/f/s!AhXT8x-JilqWhfhlSFN0IQUAffh6mA – ClaudiaWey Aug 15 '18 at 00:54
  • Try to zoom the canvas, then move the ruler right after. The ruler is stuck until you stroke the canvas, then the ruler unlock, but it locks again at the next zoom – ClaudiaWey Aug 15 '18 at 00:58
  • I can see the issue in my side. After some attempt, it seems that the InkCanvas should get focus firstly before we can move the ruler again, that is the reason we need to draw a stroke on the canvas. – Breeze Liu - MSFT Aug 15 '18 at 08:49
  • Can I focus the InkCanvas programmatically? I couldn't figure out how to do that. – ClaudiaWey Aug 15 '18 at 11:13
  • Or any other way to achieve that without the need to interactively stroking the canvas. – ClaudiaWey Aug 15 '18 at 11:42
  • Sorry for the time delay, we are still working on this. I have report it in our internal channel, other engineer are looking into it. – Breeze Liu - MSFT Sep 05 '18 at 02:36
  • Thanks so much for the update. Currently, I had to disable the ruler for devices where users use touch for both ink and zoom. I am looking forward to a solution to enable the ruler on all devices. – ClaudiaWey Sep 16 '18 at 00:48
  • After much effort, we have a scenario for this issue by removing and adding the Ruler again when you zoom and move the the ruler. Do you think it would satisfy your requirement? – Breeze Liu - MSFT Sep 20 '18 at 06:03
  • Could you help me with how to do that? I could not find API to remove the ruler once added, and if I try to add it again I get an exception. What is the code to remove the ruler? – ClaudiaWey Sep 24 '18 at 12:30
  • @BreezeLiu-MSFT - how do I remove the ruler? Destroying and rebuilding the ruler on the same InkCanvas generates an exception. I can't find an API to remove the ruler. Am I missing something? – ClaudiaWey Sep 29 '18 at 13:00
  • Sorry for the time delay, we have tried the workaround, but it is still not work. We are considering file it as a known issue in our system, sorry for the inconvenience. – Breeze Liu - MSFT Oct 01 '18 at 01:37
  • @ClaudiaWey I'm just here to show you some info. This issue is being investigated potentially for a future version of Windows. – Barry Wang Oct 25 '18 at 05:26
  • That is fantastic news. Thanks for the update! – ClaudiaWey Oct 26 '18 at 01:15

0 Answers0