-
Notifications
You must be signed in to change notification settings - Fork 432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redundant coordinate when finish polygon with double click #147
Comments
Hello, I agree with B being a little hacky but delay with clicks would be awful with solution A. You must keep good performances you got so far. |
thanks for the feedback. I can definitely understand that. 🤔 it's a tough one. I have to think a bit more about the solution before implementing it. |
Currently, i just snap. I draw three point polygon but when I export it as geojson it has four points (first and last are duplicate) |
@leekosal that's the geojson spec |
i see. thanks 👍 |
I tried double click, but it doesn't work. I set up a demo: http://jsfiddle.net/LnzN2/1225/. Could we solve it with right click button (so there is no problem with clicking and adding vertex? |
@themre finishOnDouble click generally works: http://jsfiddle.net/LnzN2/1226/ The problem in your fiddle is, that the Toolbar doesn't accept the same options as the API. |
Could we provide option
|
that's a neat idea. Please do a PR, I'll review next week 👍 |
could you take a look at PR if there is something else i'm missing? |
Unfortunately the double click bug is still happening and I'm not sure how to work around it. Unfortunately the second click generates a new vertex at a slightly different location than the original one. Sometimes this causes a self-intersect issue (the layer creates fine but once I go into edit mode it shows me a self-intersect problem that I'm unable to "fix") I'm tempted to ignore the last vertex when the user double clicks but that is a far from ideal solution. Anyone managed to work around this? |
* Fixes #147: Redundant coordinate when finish polygon with double click * Do not remove last vertex on touch interactions since double tap doesn't create an extra vertex.
* Fire Circle Edit Event * added start script * removal button now respects pmIgnore, fixes #172 * add babel polyfill * added polyfill to build config as well * wops, forgot it here 🤔 * added polyfill to fix #173 * removed babel-polyfill * * More polyfills for IE: - Object.assign() is needed for snapping - Element.remove() is needed when removing control buttons * demo.js dumbed down for IE11: - IE doesn't understand thoose fancy lambdy style expressions - object literals always need a key * increased version * 0.17.1 * link to new demo page * fix #179 * fix #180 * version bump * 0.17.2 * fixed manual install desc * fix #182 * removed uncessary if statement * used setLatlngs to update LInes and Polygons. Hopefully fixes #181 * fixed coord diff from line and poly * clarified function name * removed console.log * added circle toolbar option * check map drag state before changing it - fix #189 * fix #185 * another demo test * thing * updated version * 0.17.3 * markers are correctly created * updated gif * continued * cursorMarker: true is now default * Change the source map and minimise the source * Should be const not var * fixed the middlemarker position problem * you can now add markers * markers can now be removed * cleanup * snapping works again 🎉 * Dragging now supports holes * cleanup * minor cleanup * basic drawing works 🎉💪 * map drag fix * removed test console log * better comments * removed console logs * properly removing cutting events * prevent pm:remove event from being fired * splitting polygons works now * updated demo tiles * made first map more demo friendly * handle toolbar button correctly * fixed typos * updated leaflet * updated readme * 0.18.0 * removed console.log * FIXED: Vertex Removal removes layer or hole (patch) (#209) * ADDED: `pm:cut` event (minor) (#211) * added cut to layerGroup * fire cut event on map and layer * updated with cut event info * added some code comments * added cutPolygon button to toolbar options * minor things * ADDED: Rectangle Support for Drawing and Editing (#196) * IMPROVED: Rearranged Toolbar and renamed some buttons (patch) (#212) * rename toolbar buttons, rearrange them, add backwards compatibility * updated options * added backwards compatibility with toggleButton * FIXED: marker edit respects draggable option now (patch) (Fixes #213) * updated version and added rect desc * 0.19.0 * updated URL to new demo page * Make HintMarker more visible (#220) (PATCH) * hopefully fix #226 * added marker index information to markerdrag events. Fixes #225 (PATCH) * Removed sourcemaps from prod build. Fixes #222 (PATCH) * add workingLayer to pm:drawstart (#221) (PATCH) * add workingLayer to pm:drawstart * update documentation and demo according to feedback on PR * minor wording fix * nothing * minor webpack optimization * Added Vertex Events (#227) (MINOR) * added first demo case * added pm:vertexadded event to drawing lines and polygons * added vertexadded and vertexremoved events to Edit class of Line and Polygon * added documentation * added syntax highlighting to markdown js 🙄 * Fix error when removing a layer during snappable drawing; fixes #208 (MINOR) * version bump to 0.20.0 * 0.20.0 * centerMarker is not draggable anymore during Circle Draw. Fixes #230 (patch) * removed console.log * removed cdnjs button * - remove extra script tag from demo (#232) * Added `finishOn` option to pass events on which to finish drawing (#233) (minor) * add option to pass event name to perform finish of polygon * update docs * fix demo example, no event for finishOn * test * properly unbind optional listener * added fallback for finishOnDoubleClick * added finishOn example * removed test * fixed bug in fallback * prevent zoom when dblclick finishes shape * added example how options can be passed to toolbar buttons * fixed encoding error * stopped the stupid thing of manually entering the versions into the CDN links 🤦♂️ * 0.21.0 * Create CODE_OF_CONDUCT.md * Create CONTRIBUTING.md * Create LICENSE * remove license in favor of LICENCE.MD * Create ISSUE_TEMPLATE.md * Update ISSUE_TEMPLATE.md * Update README.md * better code syntax highlighting * updated turf and webpack * Fix 🐛 for switching drawing modes, fixes #242 and other problems (patch) (#240) * ADDED: `allowSelfIntersection` option (minor) (#241) * started on it * kinda works * nothing * ok works for drawing * lots of stuff is working now * invalid style is resetted on disable * hasSelfIntersection now works without edit mode * added code comments * added README docs * style is now handled by css class * fix when vertex removal causes valid poly * changed invalid style to just stroke * fixed toolbar bug * vertexremoved event is now only listened to when allowSelfIntersection is true * intersection for the cutting polygon is now forbidden * invalid class is now correctly removed on disable * handle error when cutting self-intersecting polygons * resulting layer of cutting now properly inherits options * just more comments * added pm:intersect event * removed console.log * made cut button snappable by default * 0.22.0 * added jsfiddle starting point * fixed some example errors * added fire, markerdragend and markerdragstart pm events to rectangle. Fixes #245 * removed a console.log * Added global edit mode toggled event. Fixes #246 (MINOR) * Added pm:update event. Fixes #229. (MINOR) * set default _globalRemovalMode to false as promised in #247 * rectangle helpers are hidden when not needed. Fixes #252 (PATCH) * fix rectangle drawing color bug (#253) (patch) * Feature/bump deps (#255) (PATCH) * bump dependencies * bump dependencies, fix webpack build * added pm:centerplaced event, fired when the center of a Circle is placed or moved. Fixes #251. (MINOR) * 0.23.0 * enable babel predets, fix #261 🤞 * minor stuff * 0.23.1 * added missing step, closes #283 * pm:edit on circles fires after edit, not during. Fixes #285 * hintline style is properly reset after showing error style, fixes #275 * dont start drag on right click, fixes #260 * Redundant coordinate when finish polygon with double click (#281) * Fixes #147: Redundant coordinate when finish polygon with double click * Do not remove last vertex on touch interactions since double tap doesn't create an extra vertex. * demo looks better on mobile now * minor changes to last PR merge * add option to disable marker removal during edit. Fixes #258 * eslint fix * added option to prevent vertex editing in edit mode. Fixes #274 * updated some deps * Support preferCanvas (#286) * Added fixes to various modules to account for preferCanvas being set to true on a Leaflet map. * minor adjustments * removed comment * 0.24.0
Double Click in leaflet will (of course) always fire the regular click twice.
When double clicking to finish a polygon, these are the events firing in order:
Current behavior:
This behavior means we have two vertexes on the same coordinates - one is redundant.
Desired behaviour:
a)
or b)
b) is kind of hacky while a) needs debounce / delay in the click handler. I might go with a), and devs who want to enable
finishOnDoubleClick
have to live with the delay for the clicks.I'd like feedback from users on this one.
The text was updated successfully, but these errors were encountered: