Commit bd9f1393 authored by aoobao's avatar aoobao

fix: 当擦除整条线段时发生的bug问题

parent 1bd4bbea
......@@ -85,6 +85,8 @@ export default class LineManager {
ctx.save()
this._lines.forEach(lineObj => {
let pixels = lineObj.pixels
// fix : 当线段全部被擦除的时候,pixels数组为空,跳过绘制 2019-4-25
if (pixels && pixels.length > 0) {
// 线条颜色
ctx.strokeStyle = lineObj.color ? lineObj.color : this._color
ctx.lineWidth = 1
......@@ -114,8 +116,7 @@ export default class LineManager {
ctx.beginPath()
ctx.arc(pixel.getX(), pixel.getY(), lineObj.lastPointSize || this._lastPointSize, 0, 2 * Math.PI)
ctx.fill()
}
});
ctx.restore()
......@@ -151,7 +152,7 @@ export default class LineManager {
delete obj.pixels
return obj
})
return list
return list.filter(t => t.line && t.line.length > 0)
}
// 擦除
......
......@@ -98,6 +98,10 @@ export default {
center: [120, 30]
})
this.map.on('click', e => {
console.log(e.lnglat)
})
// // // 测试代码
// setTimeout(() => {
// this.addLine({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment