Polyline options

Open
#178 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript
Domain
frontend

Research direction

Start at the L.EditControl.onAdd entry point shown in the issue, especially the callback invocation that creates the polyline. Reproduce the reported error and trace how callback arguments are handled; done should mean the control can pass polyline options such as weight without producing the error.

Written by the indexing model from the issue text.

Description

Is it possible to add some options to polyline, created by control?
For example, window.LAYER = this.options.callback.call(map.editTools,{weight: 5});
in code

    L.EditControl = L.Control.extend({

        options: {
            position: 'bottomright',
            callback: null,
            kind: '',
            html: ''
        },

        onAdd: function (map) {
            var container = L.DomUtil.create('div', 'leaflet-control leaflet-bar'),
                link = L.DomUtil.create('a', '', container);

            link.href = '#';
            link.title = 'Create a new ' + this.options.kind;
            link.innerHTML = this.options.html;
            L.DomEvent.on(link, 'click', L.DomEvent.stop)
                      .on(link, 'click', function () {
                        window.LAYER = this.options.callback.call(map.editTools,{weight: 5});
                      }, this);

            return container;
        }

    });

    L.NewLineControl = L.EditControl.extend({

        options: {
            position: 'topleft',
            callback: map.editTools.startPolyline,
            kind: 'line',
            html: '\\/\\',
        }

    });

produce error.

Dominant language
JavaScript
Stars
606
Forks
190
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Leaflet/Leaflet.Editable

All issues in Leaflet/Leaflet.Editable

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.