GithubHelp home page GithubHelp logo

How to use on mobile? about leaflet.heat HOT 3 CLOSED

leaflet avatar leaflet commented on May 27, 2024
How to use on mobile?

from leaflet.heat.

Comments (3)

IvanSanchez avatar IvanSanchez commented on May 27, 2024

How can I reconfigure it so that it works with devices like iPad?

In which way does it fail?

This is a good time to remember How To Ask Questions The Smart Way.

For this case in particular, a bad question is "How do I make this work on an iPad?", and a good question would be "I've tried to do X on an iPad and was expecting Y, but instead I've got Z, what's wrong?".

I've researched and I see that I need to add touch events instead of the mouse handlers that we have in the sample code on Mapbox.

Are you sure of that?

Can anyone help, please?

Yes.

from leaflet.heat.

shivanil avatar shivanil commented on May 27, 2024

Hi Ivan, I've reacted to your comments above to ensure that this is a useful question to the rest of the community. I have also now watched the entire video that you've linked to.

I believe I see the answer at 36:00. In the video, he starts by determining whether any mouse coordinates are returned or whether targetTouches has returned an object in the map div we're looking at:

                    var posX, posY;

                    function positionHandler(e) {
                    if ((e.clientX) && (e.clientY)) {
                        posX = e.clientX; posY = e.clientY;
                    } else if (e.targetTouches) {
                        posX =  e.targetTouches[0].clientX;
                        posY = e.targetTouches[0].clientY;
                        e.preventDefault();
                        }
                    }

I understand that we're defining a function here to return the coordinates of a mouse or touch event on screen. The question now is how to use this function properly within the statement that starts with map.on() { ... }. Any help would be appreciated.

from leaflet.heat.

IvanSanchez avatar IvanSanchez commented on May 27, 2024

You're still not asking a good question.

This is the issue tracker for Leaflet.heat, so what part of Leaflet.heat is not working for you?

from leaflet.heat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.