deck.gl icon indicating copy to clipboard operation
deck.gl copied to clipboard

IconLayer icon disappear

Open HeiYanjing opened this issue 7 years ago • 6 comments

before some days I update deck.gl version to v7 "@deck.gl/core": "^7.1.7", "@deck.gl/geo-layers": "^7.1.7", "@deck.gl/layers": "^7.1.7",

when I load IconLayer, it succeeded。 image after I dragged the map,Icon disppear image no matter change the zoom level or move the map position Icons sometimes appear and sometimes disappear

HeiYanjing avatar Aug 07 '19 11:08 HeiYanjing

Have you checked the icon example?

If you still have troubles with seeing the icon while dragging, you can share your code snippet here.

xintongxia avatar Aug 07 '19 17:08 xintongxia

@xintongxia thank you for your reply. I checked the documention iconlayer example. this is my code

     const exhibitoncityIncons = require('../../../../public/resources/images/cityIcon.png');
     const exhibitionMappings = require('../../../../public/resources/data/exhibition_icon_mapping.json');


      new IconLayer({
          id:'city-layer',
          data:this.props.map.cityIcons,
          pickable: true,
          iconAtlas:exhibitoncityIncons,
          iconMapping:exhibitionMappings,
          sizeScale: 150,
          getPosition: d => d.coordinates,
          getIcon: d => d.icon,
          onClick: info => this.iconClick(info),
      }),

HeiYanjing avatar Aug 08 '19 02:08 HeiYanjing

I did a simple IconLayer example, you can play around with your own icon parametres.

https://codesandbox.io/embed/peaceful-joliot-xvufo

I'll update the doc.

xintongxia avatar Aug 09 '19 04:08 xintongxia

@xintongxia ok, thank you fory your share. I have another question. Whether there is a attribute to set Icon hiding or display. for example , when zoom level >8 and zoom level <14 ,Icon display .ohterwise ,hiding Icon layer? thank you

HeiYanjing avatar Aug 09 '19 06:08 HeiYanjing

there is a onViewStateChange callback you can listen to, which has the zoom level info and you can decide whether to render IconLayer from there

Also I updated the coodesandbox

xintongxia avatar Aug 09 '19 12:08 xintongxia

@xintongxia thank you. you are the kindest person in the world.

HeiYanjing avatar Aug 10 '19 08:08 HeiYanjing