如何设计传单中的路径样式?

Don*_*n P 1 css leaflet

我有使用该选项设置样式的线条几何图形dashArray。我正在尝试添加黑色轮廓来区分较浅底图上的间隙。

我尝试在下面添加一条具有较重重量的黑色路径来创建轮廓,但间隙似乎是透明的。

将以下样式应用到各个图层将创建一条带有黑色轮廓的白线:

path = {
    color: '#ffffff',
    weight: 3,
    opacity: 1
}

outline = {
    color: '#000000',
    weight: 5,
    opacity: 1
}
Run Code Online (Sandbox Code Playgroud)

当我应用dashArray底层时,显示出来:

path = {
    color: '#000000',
    weight: 3,
    opacity: 1,
    dashArray: '5,10'
}

outline = {
    color: '#000000',
    weight: 5,
    opacity: 1
}
Run Code Online (Sandbox Code Playgroud)

有没有一种简单的方法可以实现这一目标?

传单路径样式选项在这里。

编辑:顶部路径dashArray本身。第二个是当我将其覆盖dashArray在较宽的黑线(轮廓)上时。第三是我想要实现的目标。

在此输入图像描述

ghy*_*ybs 5

只需两条路径即可达到相同的效果:

  1. 背景,连续且更广泛。
  2. 前景,虚线且较窄。透过缝隙可以看到背景。

这不是完全相同的结果,因为如果您想要圆形大写字母,则可以通过白色破折号获得它们。但如果你想要真正的方形大写字母,如下所示,那么你会得到相同的效果:

虚线路径

var map = L.map("map").setView([0.4, 0], 8);
var coords = [
  [0, -1],
  [0, 1],
  [1, 1]
];

// Background continuous black stroke, wider than dashed line.
L.polyline(coords, {
  weight: 10,
  lineCap: 'square', // Optional, just to avoid round borders.
  color: 'black'
}).addTo(map);

// Foreground dashed white stroke, narrower than background.
L.polyline(coords, {
  weight: 6,
  dashArray: '5, 10',
  lineCap: 'square', // Optional, just to avoid round borders.
  color: 'white'
}).addTo(map);
Run Code Online (Sandbox Code Playgroud)
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.2.0/dist/leaflet.css">
<script src="https://unpkg.com/leaflet@1.2.0/dist/leaflet-src.js"></script>
<div id="map" style="height: 200px"></div>
Run Code Online (Sandbox Code Playgroud)