MCPcopy Create free account
hub / github.com/dwilhelm89/Leaflet.StyleEditor / setupControl

Function setupControl

src/javascript/Control.js:3–427  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1import 'leaflet'
2
3export default function setupControl () {
4 L.Control.StyleEditor = L.Control.extend({
5 options: {
6 position: 'topleft',
7
8 colorRamp: ['#1abc9c', '#2ecc71', '#3498db', '#9b59b6', '#34495e', '#16a085', '#27ae60', '#2980b9', '#8e44ad',
9 '#2c3e50', '#f1c40f', '#e67e22', '#e74c3c', '#ecf0f1', '#95a5a6', '#f39c12', '#d35400', '#c0392b',
10 '#bdc3c7', '#7f8c8d'],
11 defaultColor: null,
12
13 markerType: L.StyleEditor.marker.DefaultMarker,
14 markers: null,
15 defaultMarkerIcon: null,
16 defaultMarkerColor: null,
17
18 geometryForm: L.StyleEditor.forms.GeometryForm,
19
20 ignoreLayerTypes: [],
21
22 forms: {},
23
24 openOnLeafletDraw: true,
25 openOnLeafletEditable: true,
26
27 showTooltip: true,
28
29 strings: {
30 cancel: 'Cancel',
31 cancelTitle: 'Cancel Styling',
32 tooltip: 'Click on the element you want to style',
33 tooltipNext: 'Choose another element you want to style'
34 },
35 useGrouping: true,
36
37 styleEditorEventPrefix: 'styleeditor:',
38
39 // internal
40 currentElement: null,
41 _editLayers: [],
42 _layerGroups: []
43
44 },
45
46 initialize: function (options) {
47 if (options) {
48 L.setOptions(this, options)
49 }
50
51 this.options.util = new L.StyleEditor.Util({styleEditorOptions: this.options})
52
53 // eslint-disable-next-line new-cap
54 this.options.markerType = new this.options.markerType({styleEditorOptions: this.options})
55 // eslint-disable-next-line new-cap
56 this.options.markerForm = new this.options.markerType.markerForm({styleEditorOptions: this.options})
57 // eslint-disable-next-line new-cap
58 this.options.geometryForm = new this.options.geometryForm({styleEditorOptions: this.options})
59
60 this.getDefaultIcon = this.options.markerType._createMarkerIcon.bind(this.options.markerType)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected