Skip to content

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

Description

@zzdoreen
<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注释、后面两个能正常展示

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions