小编sin*_*ejh的帖子

在Leaflet中旋转标记

如何在传单中旋转标记?我会有很多标记,都有旋转角度.

我试图从该解决方案runanet/coomsie单张GitHub上,但没有与我的标记发生的情况:

L.Marker.RotatedMarker= L.Marker.extend({    
    _reset: function() {
        var pos = this._map.latLngToLayerPoint(this._latlng).round();

        L.DomUtil.setPosition(this._icon, pos);
        if (this._shadow) {
            L.DomUtil.setPosition(this._shadow, pos);
        }

        if (this.options.iconAngle) {
            this._icon.style.WebkitTransform = this._icon.style.WebkitTransform + ' rotate(' + this.options.iconAngle + 'deg)';
            this._icon.style.MozTransform = 'rotate(' + this.options.iconAngle + 'deg)';
            this._icon.style.MsTransform = 'rotate(' + this.options.iconAngle + 'deg)';
            this._icon.style.OTransform = 'rotate(' + this.options.iconAngle + 'deg)';
        }

        this._icon.style.zIndex = pos.y;
    },

    setIconAngle: function (iconAngle) {

        if (this._map) {
            this._removeIcon();
        }

        this.options.iconAngle = iconAngle;

        if (this._map) {
            this._initIcon();
            this._reset();
        } …
Run Code Online (Sandbox Code Playgroud)

javascript icons rotation marker leaflet

12
推荐指数
2
解决办法
1万
查看次数

标签 统计

icons ×1

javascript ×1

leaflet ×1

marker ×1

rotation ×1