Graphics Layer graphics redraw incorrectly after zoom

3779
1
04-17-2015 02:47 PM
deleted-user-ugCMpXci8bn5
New Contributor III

I am working on a web application that has several Graphics Layers, with ArcGIS JS API  3.8 (AMD).  These layers add Picture Marker Symbols at specific and unique angles to the midpoints of line segments, which are located by a query.  The angle is calculated by finding the each line segment's beginning and end nodes, and using those x/y coordinates to calculate the bearing (the picture is an arrow, signifying street direction).

This is working for the initial rendering of the graphics, but if I zoom in or out of the map, the graphics redraw all alt the same angle.  My guess is that this has something to do with the timing of the rendering; the graphics are rendering before the correct angle for each new graphic is re-calculated.

How can I correct this problem?

0 Kudos
1 Reply
deleted-user-ugCMpXci8bn5
New Contributor III

The problem was that I was calculating the angle for the marker symbol variable, rather than each instance of the symbol added to the graphics array.  I changed the loop where the graphics are added, so that each new addition created a new instance of the marker symbol with its own angle calculated.  Now the orientation of the symbol stays consistent.

0 Kudos