You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2021/11/26 06:23:07 UTC

[GitHub] [echarts] grigiada commented on issue #16103: zoom / datazoom in touchscreen

grigiada commented on issue #16103:
URL: https://github.com/apache/echarts/issues/16103#issuecomment-979724403


   Thank you for your reply.
   No particular device is needed to test the malfunction but any touch
   monitor connected to a windows pc.
   I seem to have solved this problem by rewriting the function that
   recognizes the touch capabilities of the monitor.
   
   In echarts.js I substitute this condition
        env.touchEventsSupported = 'ontouchstart' in window && !browser.ie &&
   !browser.edge;
   with this one:
        env.touchEventsSupported = detectTouchscreen();
   
   where the function detectTouchscreen() is implemented as follows:
   
   function detectTouchscreen() {
           var result = false;
           if (window.PointerEvent && ('maxTouchPoints' in navigator)) {
               // if Pointer Events are supported, just check maxTouchPoints
               if (navigator.maxTouchPoints > 0) {
                   result = true;
               }
    } else {
               // no Pointer Events...
               if (window.matchMedia &&
   window.matchMedia("(any-pointer:coarse)").matches) {
                   // check for any-pointer:coarse which mostly means
   touchscreen
                   result = true;
               } else if (window.TouchEvent || ('ontouchstart' in window)) {
                   // last resort - check for exposed touch events API / event
   handler
                   result = true;
               }
           }
           return result;
       }
   
   I hope it will be useful to improve the functioning of your library.
   
   Reading the forums I am not the only one with this problem and it would be
   very useful if the next release had this function.
   
   Have a good day.
   
   Giada
   
   Il giorno ven 26 nov 2021 alle ore 06:03 Yi Shen ***@***.***>
   ha scritto:
   
   > @grigiada <https://github.com/grigiada> I'm afraid we don't have the
   > specifc device to do the test. Do you mind taking a deep look at it and
   > report us with more detail?
   >
   > —
   > You are receiving this because you were mentioned.
   > Reply to this email directly, view it on GitHub
   > <https://github.com/apache/echarts/issues/16103#issuecomment-979698876>,
   > or unsubscribe
   > <https://github.com/notifications/unsubscribe-auth/AWUODFRJ36CT3HEVBHB5AODUN4IJNANCNFSM5IVJSMOA>
   > .
   > Triage notifications on the go with GitHub Mobile for iOS
   > <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
   > or Android
   > <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
   >
   >
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org