Coder Social home page Coder Social logo

Comments (1)

chugcup avatar chugcup commented on August 19, 2024

I looked into this a little today, and it seems that when you use the Canvas renderer it wants to reference a _dashArray property on the Poly object when updating the style via setStyle. This property is present after editing but because it is never set on the initial Poly object, when it reverts back to the "original" style it skips updating that property; this means dashArray is set to null but _dashArray is still set to [10, 10] when it goes to restore the style after editing.

I was sort of able to patch this by adding this property if it wasn't set on the original style when editing is enabled:

// src/edit/handler/EditToolbar.Edit.js
//   - Line 188 (inside _enableLayerEdit)
if (!layer.options._dashArray) {
    layer.options._dashArray = [];
}

This wouldn't quite solve the issue if the original styling had dashes, so I'm not positive this is a working fix. Also, the Canvas renderer seems to have other issues like properly rendering the dashed lines when editing starts (I had to move the map to trigger a redraw).

I also encountered a weird issue when drawing a Polyline using a canvas: the last solid line doesn't get rendered on the map after placing a marker, but only if there is an odd number of markers in the Polyline. So if your polyline has 4 markers placed, it looks normal, but when you place the 5th, it won't draw the 4->5 line. Place a 6th marker, and all the lines are drawn correctly. No clue on that one but it seemed relevant to this.

BTW my testing was done using Chrome 53.0.2785.143 (64-bit - OSX)

Edit: I also confirmed this only happens on the 1.0.0+ branch (and 0.7.x is unaffected)

from leaflet.draw.

Related Issues (4)

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.