Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@antv/l7-district里面的layer点击事件如何处理 #454

Closed
Miogaror opened this issue Jul 26, 2020 · 2 comments
Closed

@antv/l7-district里面的layer点击事件如何处理 #454

Miogaror opened this issue Jul 26, 2020 · 2 comments

Comments

@Miogaror
Copy link

Miogaror commented Jul 26, 2020

  • L7 Version: v2.2.26
  • Platform: Mac
  • Mini Showcase(like screenshots):
  • CodePen Link:

Mini Showcase

init() {
            const scene = new Scene({
                id: 'map',
                map: new GaodeMap({
                    center: [106.230909, 38.487193],
                    style: 'dark',
                    pitch: 30,
                    zoom: 5,
                    minZoom: 3,
                    maxZoom: 10
                })
            })

            scene.on('loaded', () => {
                const layer = new ProvinceLayer(scene, {
                    joinBy: ['code'],
                    adcode: ['640000'],
                    depth: 2,
                    simplifyTolerance: 0.01,
                    label: {
                        field: 'NAME_CHN',
                        textAllowOverlap: false
                    },
                    fill: {
                        activeColor: '#000811'
                    },
                    stroke: '#000811',
                    popup: {
                        enable: true,
                        Html: props => {
                            return `<span>${props.NAME_CHN}</span>`
                        }
                    }
                })

                layer.fillLayer.on('click', e => {
                        console.log(e)
                 })
            })
        }

如何使用点击事件~并获得点击区域的acode

@thinkingGIS 麻烦您抽时间,帮忙看下

@Miogaror
Copy link
Author

Miogaror commented Jul 27, 2020

              layer.on('loaded', () => {
                    layer.fillLayer.on('click', e => {
                        console.log(e)
                    })
                })

已解决,参考drillDown.ts

@nimeila
Copy link

nimeila commented Oct 30, 2024

请问如何修改new ProvinceLayer配置项里的depth? 目前遇到直辖市和非直辖市要动态切换,四个直辖市不能直接显示下面的区

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants