ui-leaflet icon indicating copy to clipboard operation
ui-leaflet copied to clipboard

LeafletPathsHelper should retain unrecognised path's options

Open eugenehuangsg opened this issue 8 years ago • 4 comments

LeafletPathsHelper.createPath would remove any options that it does not recognise.

Currently recognised options: var availableOptions = [ // Path options 'stroke', 'weight', 'color', 'opacity', 'fill', 'fillColor', 'fillOpacity', 'dashArray', 'lineCap', 'lineJoin', 'clickable', 'pointerEvents', 'className', // Polyline options 'smoothFactor', 'noClip' ];

Can other options be retained so that extensions will still be able to access them? It will be desirable to be able to customise each path with a different context menu.

eg: m1: { lat: 51.50, lng: -0.082, contextMenuCustom: [{ text: 'London item', }], }, m2: { lat: 48.83, lng: 2.37, contextMenuCustom: [{ text: 'Some other item', }, { text: 'Second item', }, ], }

For full example: please see http://jsfiddle.net/s8ka3epp/, which consist of two markers and one path. Note that in the example, the context menu for path is not working precisely because it was filtered out.

eugenehuangsg avatar May 08 '16 09:05 eugenehuangsg

Well if availableOptions was made public then you would be able to override the factory to use whatever availableOptions you want. However, a simple hack PR for now would just include those extra features onto availableOptions .

nmccready avatar Jun 08 '16 02:06 nmccready

Also by overriding I mean you would be able to use a decorator at angular.config time.

nmccready avatar Jun 08 '16 02:06 nmccready

Let me know how you think this should be.

nmccready avatar Jun 08 '16 02:06 nmccready

What is the point of availableOptions at first place?

samehraban avatar Jul 16 '16 07:07 samehraban