在传单绘制中更改顶点样式

时间:2018-04-27 13:26:33

标签: leaflet leaflet.draw

宣传单画的边缘太大而且难看,我已经找到了改变其风格的方法,我想出了以下代码:

 draw: {
        polyline: {
            shapeOptions: this.onSelectionStyle
        },
        polygon: {
            icon: new L.DivIcon({
                iconSize: new L.Point(16, 16),
                className: 'leaflet-div-icon leaflet-editing-icon my-own-icon'
            }),
            allowIntersection: false, // Restricts shapes to simple polygons
            drawError: {
                color: '#e1e100', // Color the shape will turn when intersects
                message: '<strong>Oh snap!<strong> you can\'t draw that!' // Message that will show when intersect
            },
            shapeOptions: this.onSelectionStyle,
            showArea: true
        },
        ...

基本上className应该这样做,但这似乎不适用于最新版本。你知道如何改变时代的风格吗?

enter image description here

1 个答案:

答案 0 :(得分:0)

我正在使用这个:

L.Edit.Poly = L.Edit.Poly.extend({
  options: {
    icon: new L.DivIcon({
      iconSize: new L.Point(10, 10),
      className: 'leaflet-div-icon leaflet-editing-icon my-own-icon',
    }),
  },
});