2

Recently I have this really weird bug : I have a new graphics-layer, that I build on runtime, with a point-graphic in it. On higher extent - ever thing's great, on lower extent (zoom-in) the graphic disappears.

I found, while debugging, that the graphics "_shape" & "_offsets" properties are null when it disappears.

I also noticed that the layer's properties "minSacle" & "maxScale" are both 0 and "visibleAtMapScale" & "visible" are true.

Beside that, everything looks as usual - the graphic stays visible and at the layer's graphics array.

1 Answer 1

1

This can happen if you change the graphic's geometry properties manually rather than using the graphic's setGeometry() method.

For example, let's say you create a point graphic:

var graphic = new Graphic(new Point(point), symbol));            
map.graphics.add(graphic);

Then later you modify the geometry's x and y values.

graphic.geometry.x = newX;
graphic.geometry.y = newY;
map.graphics.redraw();

This approach seems to work fine until you start zooming or panning. Whenever you move to an extent that does not include the graphic's initial point, the graphic disappears. So setGeometry() must call additional code for everything to work properly.

Not the answer you're looking for? Browse other questions tagged or ask your own question.