【问题标题】:How to place image between two marker using css : leaflet如何使用 css 在两个标记之间放置图像:传单
【发布时间】:2015-10-03 09:42:28
【问题描述】:

在我使用传单 api 的应用程序中,我可以放置两个门标记并在它们之间绘制折线。

在这里,我只是想找出将 css 中的图像放在应该适合两个标记之间的折线上的方法。我知道图像具有宽度和高度。

我相信一定有一些 css 技巧可以做到这一点,尽管由于对传单的了解有限,我不能使用填充图案方法。

脚本(在它们之间放置两个标记和线)

var polylineGate2 = new L.Polyline([], { color: 'yellow' });
            function gatePlace2(e) {
                // New marker on coordinate, add it to the map
                new L.Marker(e.latlng, { icon: gateIcon, draggable: false }).addTo(currentFeatureGroup);
                // Add coordinate to the polyline
                polylineGate2.addLatLng(e.latlng).addTo(currentFeatureGroup);
                var decorator = L.polylineDecorator(polylineGate2, {
                    patterns: [
                        // define a pattern of 10px-wide dashes, repeated every 20px on the line
                        { offset: 5, repeat: '20px', symbol: new L.Symbol.dash({ pixelSize: 4 }) }
                    ]
                }).addTo(currentFeatureGroup);
                map.off('click', gatePlace2);
                polylineGate2 = new L.Polyline([], { color: 'pink' });
            }

我正在寻找解决方案,但没有在线获得帮助,如果有人知道这种情况,请提供帮助。

【问题讨论】:

    标签: leaflet angular-leaflet-directive dc.leaflet.js


    【解决方案1】:

    我不会为此使用 CSS。

    相反,我会calculate the coordinates of the middle point 并在其中放置custom marker

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-10-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多