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

多个marker的icon为不同的雪碧图、只会展示其中一张雪碧图的marker图标 #85

Open
zzdoreen opened this issue Aug 14, 2024 · 0 comments

Comments

@zzdoreen
Copy link

<Map enableScrollWheelZoom center={{ lng: 104, lat: 31 }} zoom={10} style={{ height: 800 }}>
            {/* 地图只展示这个图标 */}
            <Marker
                position={{ lng: 104, lat: 31 }}
                icon={new BMapGL.Icon('/imgs/sprite.png', new BMapGL.Size(40, 40), {
                    imageSize: new BMapGL.Size(1920, 1080),
                    imageOffset: new BMapGL.Size(511, 1036)
                })}
            />
            {/* 这两个不展示 */}
            <Marker
                position={{ lng: 104.1, lat: 31.1 }}
                icon={new BMapGL.Icon('/imgs/sprite2.png', new BMapGL.Size(40, 40), {
                    imageSize: new BMapGL.Size(1920, 1200),
                    imageOffset: new BMapGL.Size(511, 1036)
                })}
            />
            <Marker
                position={{ lng: 104, lat: 31 }}
                icon={new BMapGL.Icon('/imgs/sprite2.png', new BMapGL.Size(40, 40), {
                    imageSize: new BMapGL.Size(1920, 1200),
                    imageOffset: new BMapGL.Size(511, 1036)
                })}
            />
        </Map>

把第一个marker注释、后面两个能正常展示

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

1 participant