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?
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.