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 🙏

© 2026 – Pkg Stats / Ryan Hefner

poly-line-point

v1.5.0

Published

基于canvas点线框vue组件

Readme

poly-line-point

基于canvas点线框vue组件 组件按钮用的是iview的button组件,可以参考iview组件按需引用

Build Setup

# install dependencies
npm install poly-line-point

import Vue from 'vue'
import polyLinePoint from 'poly-line-point'

Vue.use(polyLinePoint)


组件调用

####非弹窗
<poly-line-point
  ref="drawPic1"
  :dom-id="canvasDraw"
  :draw-type-arr="drawTypeArr"
  :draw-pic="drawPic1"
>
  <Button type="primary" @click="updatePic('1')">随机更新图片</Button>
</poly-line-point>

####弹窗
<poly-line-point
  :init-draw-data="initDrawData"
  :is-show-box="isShowBox"
  :is-modal="true"
  :dom-id="canvasDrawT"
  :draw-type-arr="drawTypeArr"
  :draw-pic="drawPic2"
  ref="drawPic2"
  @after-draw-cb="drawEnd"
>
  <Button type="primary" @click="updatePic('2')">随机更新图片</Button>
</poly-line-point>

props: {
      //  实例dom id
      domId: {
        type: String,
        default: 'canvasDraw'
      },
      //  画图底图url
      drawPic: {
        type: String,
        default: ''
      },
      //  初始化绘画类型
      initDrawType: {
        type: String,
        default: 'polygon'
      },
      //  点线框按钮  polygon-框 line-线 point-点 arrow-箭头
      drawTypeArr: {
        type: Array,
        default: [
          {icon: 'polygon', disabled: false},
          {icon: 'line', disabled: false},
          {icon: 'point', disabled: false},
          {icon: 'arrow', disabled: false}
        ]
      },
      //  画布高
      drawHeight: {
        type: Number,
        default: 400
      },
      //  点线框全局配置
      config: {
        type: Object,
        default: () => ({
          max: 200,                             //  点线框绘画允许最大数量
          pointColor: 'rgb(218,140,16)',        //  画点,点颜色
          pointSize: 5,                         //  画点,点尺寸大小
          lineColor: 'rgb(0, 166, 90)',         //  画线,线颜色
          lineSize: 2,                          //  线,线条宽度
          textColor: '#333',                    //  填充文案,字体颜色
          polygonFillColor: 'rgba(0,174,217,0.4)',  //  画框,框填充颜色
          polygonLineColor: 'rgb(0,174,217)',       //  画框,边框填充颜色
        })
      },
      //  是否作为弹窗
      isModal: false,
      //  弹窗显示变量
      isShowBox: {
        type: Boolean,
        default: false
      },
      //  初始化点线框数据
      initDrawData: {
        type: Array,
        default: () => ([])
      }
    }

  Events:
    @after-draw-cb="drawEnd" 每次画完回调 drawEnd(drawData, drawType)
    drawData -- 当前画布数据
    drawType -- 当前绘画类型

  Methods:
    clean(isCleanAll, imgSrc) 清空画布 (isCleanAll--Boolean, imgSrc--String 需要重绘画布背景图以及所有点线框数据则传递这两个参数,纯粹的清空点线框数据则调用clean())

    getDrawData()  获取画布点线框数据

    setDrawType(type)  设置绘画类型(type--boolean)

    setCanDraw(boolean)  画布是否可以继续绘画

    dispose()  画布实例销毁

  Slot:
    动态改变图片按钮

  Slot:name="noImg"
  <slot name="noImg"></slot>  自定义没有图片占位符