Skip to content
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

What's the status of the Leaflet v1.0 branch of Leaflet.draw? #455

Open
germanjoey opened this issue Oct 28, 2015 · 19 comments
Open

What's the status of the Leaflet v1.0 branch of Leaflet.draw? #455

germanjoey opened this issue Oct 28, 2015 · 19 comments
Labels
Milestone

Comments

@germanjoey
Copy link

Is it good to go? I'm starting a new project and would like to use Leaflet v1.0, but I also need Leaflet draw. Thanks.

@Brutusn
Copy link

Brutusn commented Oct 28, 2015

I have a running leaflet v1 with the draw plugin (that special branch). It required some code changes in the draw plugin itself to work, but it does work.

The only problem is when drawing things (best noticed with polygons) you can see the bounding box. Parts of the polygon are hidden until you complete the shape. It could be that I do something wrong but this is what I noticed.

@germanjoey
Copy link
Author

What sorts of code changes did you need to make? Could you post them to a gist or somesuch?

@Brutusn
Copy link

Brutusn commented Oct 30, 2015

I took the code from the leaflet-master branch. One of the problems I noticed was this one: #450

The rest of the problems is just adding it, debugging it, and see where it fails. ( I can't remember all code changes I made, but there weren't a lot. )

@germanjoey
Copy link
Author

Uh, I guess I'll just wait for an official release...

@codeofsumit
Copy link

I'm in the same boat as you. We need to use leaflet 1.0 in our production environment (and it works fine) but leaflet.draw (or any other library that enables me to edit polygons / geoJson layers that I've tried) has lots of issues with it.

@codeofsumit
Copy link

@germanjoey as we couldn't wait anymore to have leaflet 1.0 covered here, I created another plugin specifically for leaflet 1.0.
I tested it with L.polygon and L.geoJson and editing the coordinates works fine.

Plugin | Demo

@Brutusn
Copy link

Brutusn commented Nov 16, 2015

Does it work properly with the polygon being on a canvas layer?

@Brutusn
Copy link

Brutusn commented Nov 16, 2015

@codeofsumit I did a quick check on with you library, it has the same problem for canvas: http://playground-leaflet.rhcloud.com/sem/1/edit?html,output

See the playground thing. The draw plugin has the same problem as you library.

@codeofsumit
Copy link

@Brutusn we're not using canvas but I'll have a look - thanks for the playground snipped!

@Brutusn
Copy link

Brutusn commented Nov 16, 2015

I made a issue on the main leaflet page, as I think that the problem is in leaflet itself.

Leaflet/Leaflet#4018

@DrYSG
Copy link

DrYSG commented Nov 19, 2015

I have beta 2 installed, and I got the /dist copy from here: https://github.com/Leaflet/Leaflet.draw/tree/leaflet-master,

What I see is that I can draw, but the edit controls are grey'ed out, and after I finish a line or polygon then it disappears. Is that what others are experiencing?

@Brutusn
Copy link

Brutusn commented Nov 20, 2015

The /dist copy is not updated with the latest code change (see the change date, 2 year ago).

I'll attach the version I use. It also contains a small fix kind of thing (line 398) To make polygons draw correctly again (editting is still not correct).
leaflet.draw-src.txt

Change the extension to js again.. otherwise GitHub didn't like it.

@DrYSG
Copy link

DrYSG commented Nov 20, 2015

@Brutusn, thanks muchly this is beyond what I expected.

However, I changed the extension, did a hard-reload in Chrome, and even put a break point at your Bart fix. What I am seeing is the same effect. I see it hits your

this._poly.redraw();

But what I see is that the poly will draw till the last point (same with line) but when you close or finish the line, the object disapears. I am using

    <script>L_PREFER_CANVAS = true;</script>

This demo, does work fine: http://leaflet.pm.kaumgeschlafen.com/demo/

@Brutusn
Copy link

Brutusn commented Nov 23, 2015

@DrYSG The demo page from the leaflet.pm doesn't use a canvas layer.

The L_PREFER_CANVAS is not used anymore in leaflet 1 (as far as I can see.) It's now an option to add when initializing the map: var map = L.map('map', {preferCanvas: true});

Also for my test I did not try to fix it for non canvas layers (I don't use those anyway). I don't have the disappearing shape in my place.

@DrYSG
Copy link

DrYSG commented Nov 23, 2015

I found the problem with my disappearing features. I have your code now working in Beta2, Drawing is working fine, So is does edit and save. But oddly enough, the cancel is not working. I don't know if this is a beta issue. I put the problem up in stack-overflow: http://stackoverflow.com/questions/33877116/leaflet-draw-does-not-cancel-properly

@DrYSG
Copy link

DrYSG commented Nov 30, 2015

@Brutusn My experimentation is showing two problems with Leaflet.draw with the Beta 2. (but neither of these problems exist in 7.7. Does anyone have more to add?

  1. Start drawing any polygon, box, circle, etc, and you get an error when canceling; Details at: http://stackoverflow.com/questions/33877116/leaflet-draw-does-not-cancel-properly
  2. Set allowIntersection: false and while there is no error, no message or error draw color is shown.
                        allowIntersection: false,
                         showArea: true,
                         drawError: {
                             color: '#e1e100',
                             timeout: 1000,
                             message: '<strong>Oh snap!<strong> you can\'t draw that!'
                         }

@Brutusn
Copy link

Brutusn commented Dec 1, 2015

@DrYSG There are still a few problem left over..

But to aswer yours:

  1. I don't have the problem for boxes and circles.. I can't really cancel anyway. But the delete last vertex was a problem I had.. But I solved it with this commit: 8943d99 (the _spliceLatLngs)

  2. This commit fixes the allow intersection. a7aca25 It doesn't seem to work for editting the polygon though.

P.S.: It's annoying but creating those "fiddles" is good to do, it's easy to spot the error: For leaflet this one is very nice: https://playground-leaflet.rhcloud.com

@ddproxy ddproxy added this to the 0.4.0 milestone Mar 6, 2016
@ddproxy
Copy link
Member

ddproxy commented Mar 6, 2016

I've stage this issue for 0.4.0 to be released as full Leaflet 1.x support. There are some API changes that need to be fixed and L@1.x is not final yet - although it's close!

@ddproxy ddproxy modified the milestones: 0.4.0, 0.5.0 Mar 7, 2016
@chugcup
Copy link
Contributor

chugcup commented Sep 13, 2016

I spent the weekend refactoring some of the internals to successfully work with both 0.7.x and 1.0.0-rc3

See #596

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants