maptalks / maptalks/maptalks.js
PolygonLayer中sector click事件在动画运行时无法触发
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 4.5k
- Forks
- 511
- Avg merge
- 3d 58m
- Merged PRs (30d)
- 1
Description
当animate动画开启时,使用PolygonLayer时点击sector区域,点击事件无法触发;使用VectorLayer则可以正常触发点击事件。
版本:maptalks-gl@0.113.4
测试代码如下:
var map = new maptalks.Map('map', {
center: [-0.113049, 51.498568],
zoom: 14,
baseLayer: new maptalks.TileLayer('base', {
urlTemplate: 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png',
subdomains: ["a", "b", "c", "d"],
attribution: '© OpenStreetMap contributors, © CARTO '
})
});
const polygonLayer = new maptalks.PolygonLayer('polygonLayer', {
zIndex: 30,
picking: true,
geometryEvents: true,
hitDetect: false
}).addTo(map)
var center = map.getCenter();
var sector = new maptalks.Sector(center.add(-0.013, -0.001), 900, 240, 300, {
symbol: {
lineColor: '#34495e',
lineWidth: 2,
polygonFill: 'rgb(135,196,240)',
polygonOpacity: 0.4
}
});
sector.on('click', () => {
console.log('sector click')
})
sector.addTo(polygonLayer)
const sectorPlayer = sector.animate(
{},
{
duration: 2000,
easing: 'out',
repeat: true
},
function (frame) {
if (frame.state.playState !== 'running') return
const currentLength = 500 + 500 * frame.state.delta
sector.setRadius(currentLength)
}
)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied maptalks-gl@0.113.4 reproduction, focusing on PolygonLayer picking and geometry events while a Sector animation updates its radius. Compare the behavior with VectorLayer; done means sector click events fire during animation as they do with VectorLayer.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100