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

options.end ? #15

Open
emileaben opened this issue Jun 8, 2014 · 3 comments
Open

options.end ? #15

emileaben opened this issue Jun 8, 2014 · 3 comments
Labels

Comments

@emileaben
Copy link

Hi,

What I'd like to achieve is putting a textpath at the end of the polyline. Would it be possible to add an option for that?

Adding this code for 'option.end' works for my particular use-case, but text placement is dependent on angle of the path still:

    /* put text at end of the path */
    if (options.end) {
        var textWidth = textNode.getBBox().width;
        var pathWidth = this._path.getBBox().width;
        /* Set the position for the left side of the textNode */
        textNode.setAttribute('dx', pathWidth - textWidth );
    }

Together with '\u25BA' something like this would allow for arrowheads on polylines.

hth,
Emile

@leplatrem
Copy link
Collaborator

Hi Emile,
For this particular use-case, I suggest you use @fredericbonifas's plugin Leaflet.LineExtremities ! It does just that, and will manage orientation automatically (SVG built-in feature) !

Otherwise, it could make sense to add this option, but unfortunately I can't spend time on this :|

@emileaben
Copy link
Author

New case where I'd want to use an 'end' option, together with an offset (LineExtremities can't do that).
Would it be ok if I created a pull request for adding the 'end' option (code+doc)?

@leplatrem
Copy link
Collaborator

Of course you can ! I would be very pleased to review and merge this contribution!
Good luck! Thanks a lot!

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

2 participants