npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

svg-junction

v0.1.3

Published

路口可视化marker(svg)动态添加工具

Downloads

11

Readme

SvgJunction

路口可视化(svg,marker)

安装

$ npm install svg-junction -S

使用

main.js 文件中引入插件并注册

# main.js
import SvgCrossing from 'svg-junction'
Vue.use(SvgCrossing)

在项目中用使用 SvgCrossing

<template>
  <svg-junction v-for="(cross_info,index) in junctionMarkerInfo"
                            :markerInfo="cross_info"
                            :map="map"
                            :svgOption="svgOption"
                            :markerIndex="index"
                            :len="junctionMarkerInfo.length"
                            @getMarker = getMarker />
  </template>
<script>
  export default {
    data () {
      return {
        map: null,
        crossMarkerInfo: crossInfo.crossMarkerInfo,
        svgOption: {
            laneBgColor: "#101021",   //车道背景颜色
            laneWidthRatio: 1,     //车道宽度比例
            laneLineColor: "#FFFFFF",   //车道标线颜色
            laneLineWidth: 2,   //车道标线宽度
            laneLineOffset: 0,     //车道标线位置偏移(距离路中心+)
            laneDivideColor: "#FFFF00",   //出入口分界线颜色(单双黄线)
            turnSignColor: "#FFFFFF",   //转向指示线默认颜色
            turnSignWidth: 3,   //转向指示线默认颜色
            zoomVisible: 11.5,        //路口可见的最小zoom级别
            zebraLineColor: "#FFFFFF",     //斑马线颜色
            zebraLineWidth: 5,     //斑马线线宽
            zebraLineInterval: 5,     //斑马线间隔
            zebraOffset: 0,     //斑马线位置偏移(距离路中心+)
            isZebraTiming: false, //斑马线是否跟随红绿灯动画
            timingColor: "#00a249",     //计时动画圆环颜色
            textColor: "#FFFFFF",     //计时动画圆环颜色
            redLightColor: "#FF3030",     //红灯禁止通行颜色
            greenLightColor: "#00a249",     //红灯禁止通行颜色
            scaleRatio: 1.5,     //zoom缩放比例
            isWaitingAreaShow:true,   //左转待转区是否显示
        },
      }
    }
  }
</script>
/**
 * @method getMarker 根据起始点、半径、角度计算圆弧路径
 * @param {Number} markers  所有路口marker信息
 * @param {Number} marker  当前点击事件的路口marker
 * @return void
 */
getMarker(markers,marker){  //所有路口marker
    console.log(markers);
    console.log(marker);
}

注意:标签为 <svg-junction>

svgOption配置参数说明: 以上为初始的默认值,若不设置则按默认值绘制

数据格式

markerInfo绑定数据,格式如下

{
  "id": "cross1", //唯一id
  "timing": true,
  "lngLat": [123.411541, 41.838356], //是否有红绿灯计时
  "crossInfo": [
     {
        "rotate": 195, //旋转角度:x轴正方向(正东方向)为零度 顺时针旋转增加度数
        //1:直行 2:左转 3:右转 4:直行+左转 5:直行+右转 6:调头
        "inLanes": [4, 3],
        "outLanes": [1, 1],
        "time": 15 //可通行时间(顺时针1、3同,2、4同)
     }
  ]
}