Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in / Register
Toggle navigation
A
amap-line-edit
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
feng
amap-line-edit
Commits
bd9f1393
Commit
bd9f1393
authored
Apr 25, 2019
by
aoobao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 当擦除整条线段时发生的bug问题
parent
1bd4bbea
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
287 additions
and
282 deletions
+287
-282
src/assets/LineManager.js
src/assets/LineManager.js
+283
-282
src/views/Home.vue
src/views/Home.vue
+4
-0
No files found.
src/assets/LineManager.js
View file @
bd9f1393
...
@@ -85,6 +85,8 @@ export default class LineManager {
...
@@ -85,6 +85,8 @@ export default class LineManager {
ctx
.
save
()
ctx
.
save
()
this
.
_lines
.
forEach
(
lineObj
=>
{
this
.
_lines
.
forEach
(
lineObj
=>
{
let
pixels
=
lineObj
.
pixels
let
pixels
=
lineObj
.
pixels
// fix : 当线段全部被擦除的时候,pixels数组为空,跳过绘制 2019-4-25
if
(
pixels
&&
pixels
.
length
>
0
)
{
// 线条颜色
// 线条颜色
ctx
.
strokeStyle
=
lineObj
.
color
?
lineObj
.
color
:
this
.
_color
ctx
.
strokeStyle
=
lineObj
.
color
?
lineObj
.
color
:
this
.
_color
ctx
.
lineWidth
=
1
ctx
.
lineWidth
=
1
...
@@ -114,8 +116,7 @@ export default class LineManager {
...
@@ -114,8 +116,7 @@ export default class LineManager {
ctx
.
beginPath
()
ctx
.
beginPath
()
ctx
.
arc
(
pixel
.
getX
(),
pixel
.
getY
(),
lineObj
.
lastPointSize
||
this
.
_lastPointSize
,
0
,
2
*
Math
.
PI
)
ctx
.
arc
(
pixel
.
getX
(),
pixel
.
getY
(),
lineObj
.
lastPointSize
||
this
.
_lastPointSize
,
0
,
2
*
Math
.
PI
)
ctx
.
fill
()
ctx
.
fill
()
}
});
});
ctx
.
restore
()
ctx
.
restore
()
...
@@ -151,7 +152,7 @@ export default class LineManager {
...
@@ -151,7 +152,7 @@ export default class LineManager {
delete
obj
.
pixels
delete
obj
.
pixels
return
obj
return
obj
})
})
return
list
return
list
.
filter
(
t
=>
t
.
line
&&
t
.
line
.
length
>
0
)
}
}
// 擦除
// 擦除
...
...
src/views/Home.vue
View file @
bd9f1393
...
@@ -98,6 +98,10 @@ export default {
...
@@ -98,6 +98,10 @@ export default {
center
:
[
120
,
30
]
center
:
[
120
,
30
]
})
})
this
.
map
.
on
(
'
click
'
,
e
=>
{
console
.
log
(
e
.
lnglat
)
})
// // // 测试代码
// // // 测试代码
// setTimeout(() => {
// setTimeout(() => {
// this.addLine({
// this.addLine({
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment