leaflet-paintpolygon
leaflet-paintpolygon copied to clipboard
Drawing over start of line deletes part of the line
This is an awesome plugin but there is one issue thats preventing me from using it.
When drawing it seems if you draw over that start of the line it deletes part of the line, I have linked a screen recording to help explain.
Video: https://youtu.be/AiDOzJPEdRs
Unrelated but after drawing for about 20 seconds chrome bug out and the page has to be reloaded.
Regards Jack
Thanks for trying using it !
I've tried some optimization (stack event to process one by one, cache some values in variables) but bug seems to be style there.
I think this issue is related to https://github.com/Turfjs/turf/issues/1393 when 2 events are fired on the same latlng
Difference is for erasing...
The turfjs lib has issue for union too: https://github.com/Turfjs/turf/issues/1209#issuecomment-354592272
I reproduce the bug : https://www.youtube.com/watch?v=4orbvl_xyg0&feature=youtu.be
The 2 functions uses 'martinez-polygon-clipping' : https://github.com/w8r/martinez
Hi @tcoupin thanks for your plugin. Are some updates for these issues? In particular, trying to use you demo page I see a lot of times the Chrome page crashes
I'm guessing that @tcoupin wants to wait for the official v7 release of turfjs, which is built with a martinez version that fixes these bugs.
If you really need these bugs gone and don't care about potential other bugs, you can easily build this yourself with the v7-alpha by replacing the _draw function in PaintPolygon,js with:
_draw: function (latlng, zoom, radius) {
if (this._data === undefined || this._data === null) {
this.setData(this._getCircleAsPolygon(latlng, zoom, radius));
} else {
let fc = {
type: "FeatureCollection",
features:[this._data, this._getCircleAsPolygon(latlng, zoom, radius)]
};
this.setData(turf.union(fc));
}
}
replacing the myTurf.js with:
import circle from 'turf/src/circle';
import union from 'turf/src/union/';
import difference from 'turf/src/difference';
let turf = {
circle: circle,
union: union,
difference: difference
};
export default turf;
and adding
"turf": "7.0.0-alpha.1"
to your package.json
Sorry for delay, I am not an expert of Turf (@lukszi seems to be one ;) ) and I don't work no more with leaflet and geodata (only on my free time).
I just publish 1.2.1-alpha.1 based on turf 7.0.0-alpha.1 following @lukszi instructions.
Hello, Do you have a solution to display the coordinates of the final polygon in a text area (textarea) or other Or as a message like "alert...." thanks