Comments (7)
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.
@ppete2 Thanks for the tip (and quick response) 👍 . I'll try and will let you know whether it worked.
from leaflet.polylinemeasure.
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:
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:
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.
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.
@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.
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.
@ppete2 Yeah, OK. Anyway, thanks for you help 👍
from leaflet.polylinemeasure.
Related Issues (20)
- error while deleting points after resume measure HOT 4
- [Suggestion] Have each pathline distance and in-out track available with `polylinemeasure:change`. HOT 1
- [Suggestion] Have the option to make the plugin on by deafult instead of off. HOT 3
- [Question] Could we get an example on how to use `measureControlClasses`? HOT 1
- Error after moving the point and clicking HOT 12
- Cursor pointer
- Cannot set properties of null (setting '_source') HOT 1
- Doesn't work with image overlays
- how to grow vertex size? HOT 1
- Units not updating if changed while drawing
- PolylineMeasure Lines and Arrows not rendering in correct location. HOT 3
- How to integrate this plugin with Angular? HOT 1
- seed() is not a function HOT 2
- Use google map HOT 1
- Change the units to residential land measurement unit HOT 3
- Disable adding new points after you finish drawing HOT 1
- Evented leaflet objects that are added while polylinemeasure is toggled on are improperly handled HOT 2
- Get segment distance, headings and total distance HOT 2
- Add arrow colour option HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leaflet.polylinemeasure.