Code Monkey home page Code Monkey logo

Comments (7)

ppete2 avatar ppete2 commented on June 28, 2024

Hi,

well I think it's possible to simulate pressing the control button by calling the method
this._toggleMeasure();
or maybe also working
L.control.polylineMeasure._toggleMeasure();

So you have to do a little bit of fiddling to make this work

from leaflet.polylinemeasure.

smellyshovel avatar smellyshovel commented on June 28, 2024

@ppete2 Thanks for the tip (and quick response) 👍 . I'll try and will let you know whether it worked.

from leaflet.polylinemeasure.

smellyshovel avatar smellyshovel commented on June 28, 2024

@ppete2

So the following code works.

this.measureTool = L.control
        .polylineMeasure({
          position: "bottomright",
          unit: "meters",
        })
        .addTo(this.map);

// <...>

// calling this one when needed
toggleMeasurement() {
  this.measureTool._toggleMeasure();
}

But I think I found a bug. Even if I'm using the standard control, look what happens when instead of finishing the path and then clicking the button to disable measurement, I click the button while still building the path:

measure-bug

The same thing happens for the custom control as well.

I can attach the full error log if you need it (though that is not the gratest option since it might accidentally disclose some NDA-related data).

Here's the error instead:

Screenshot_20211104_135824

Please, tell me if you need any additional information. Would be happy to help.

And yes, thank you for your help of couse!

from leaflet.polylinemeasure.

ppete2 avatar ppete2 commented on June 28, 2024

Hi, is this just occuring with your own code? Or in other words: Is this also happening if you use Demo 2 or Demo 3 for example?
(I used Demo 2 and cannot reproduce the bug)

from leaflet.polylinemeasure.

smellyshovel avatar smellyshovel commented on June 28, 2024

@ppete2 no, it happens with neither of them. For some reason it's only my code.

It's not crucial, everything seems to work just fine (even with the error thrown), but would still be nice to get rid of the error. Any ideas over why can that happen and how to solve the issue?

Once again, huge thanks for your participation!

from leaflet.polylinemeasure.

ppete2 avatar ppete2 commented on June 28, 2024

Sorry, I'm not able to analyze what's causing the error messages. You've to contact a JS-expert for example in a JS forum to help you with this error messages in combination with your script (init-map.common.js)

from leaflet.polylinemeasure.

smellyshovel avatar smellyshovel commented on June 28, 2024

@ppete2 Yeah, OK. Anyway, thanks for you help 👍

from leaflet.polylinemeasure.

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.