add canvas extend plugin
This commit is contained in:
parent
b6c9daf398
commit
e7db599043
|
@ -0,0 +1,23 @@
|
|||
export function drawLine (ctx, lineBegin, lineEnd, lineWidth = 2, lineColor = '#000') {
|
||||
if (!ctx || !lineBegin || !lineEnd) return
|
||||
|
||||
ctx.beginPath()
|
||||
|
||||
ctx.moveTo(...lineBegin)
|
||||
ctx.lineTo(...lineEnd)
|
||||
|
||||
ctx.closePath()
|
||||
|
||||
ctx.lineWidth = lineWidth
|
||||
ctx.strokeStyle = lineColor
|
||||
|
||||
ctx.stroke()
|
||||
}
|
||||
|
||||
const canvas = {
|
||||
drawLine
|
||||
}
|
||||
|
||||
export default function (Vue) {
|
||||
Vue.prototype.canvas = canvas
|
||||
}
|
|
@ -1,5 +1,8 @@
|
|||
import methodsExtend from './methodsExtend'
|
||||
|
||||
import canvasExtend from './canvasExtend'
|
||||
|
||||
export default function (Vue) {
|
||||
methodsExtend(Vue)
|
||||
canvasExtend(Vue)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue