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

a little mistake about the "_createText" method in the source code #128

Open
xiallyspider opened this issue Jun 6, 2018 · 3 comments
Open

Comments

@xiallyspider
Copy link

v0.3.1 ->leaflet-dvf.js

   _createText: function (layer) {
        // var options = layer.options.text || {};
        var options = layer.options || {};
       ......
        var textNode = document.createTextNode(options.text);
       ......
     }
@sfairgrieve
Copy link
Contributor

Thanks for pointing this out, and apologies for the confusion. The source code is actually the intended behavior. The layer text option tells the code that you want to display text on the SVG element and provides configuration options for that text element that will be displayed. One parameter is text, which is the actual text to be displayed, but you can also provide a path option that tells the browser to display the text along a path (if the element is a line or polygon) or provide more advanced styling options or override specific SVG text element attributes for the SVG text element that gets created. For example:

var thing = new L.<object>(<geometry>, {
   text: {
      text: 'Test',
      attr: {
         // Keys/values for SVG text element attributes to specify explicitly
      },
      style: {
         'fill':  '#123',
         'stroke': '#fff'
      },
      path: {
          startOffset: '65%'
      }
   }
}

Does that make sense?

@xiallyspider
Copy link
Author

Opps, It seems that I did not look carefully enough,sorry for it and appreciate your patience.Now I know how to use it

@valerio-bozzolan
Copy link

@xiallyspider can you please mark as resolved? :)

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

No branches or pull requests

3 participants