GraphicsLayer not redrawing visually while a Graphic is being dragged

1110
1
06-06-2018 08:21 PM
NickDragunow
New Contributor

I've implemented a 'route between points' site using the 4.7 JavaScript API. The logic works fine, but I'm having a graphical display issue: when a point is picked up and dragged to a new location it doesn't redraw intermittently, the mouse simply drags an invisible point to the new location, where it reappears. 

The 'update' event fires every time the mouse moves, but the graphics layer won't redraw on the screen, even when cloning the graphic, deleting it from the graphics layer, and re-adding it - the usual fix for a graphic not re-drawing upon being edited.

Oddly, everything works fine if the user zooms in or out of the map while gripping the point. Things start drawing, and the greyOutAllRouteLines function (which sets the colour of every line on the map to grey, to indicate that with the shifted point they're now out of date) works as advertised. In both cases the remove/clone/re-add method is required, otherwise nothing redraws regardless of map interaction.

It feels like the graphics layers are being updated quite happily while the 'update' events are firing, but they aren't being prompted to re-draw until the map is interacted with, at which point they function as expected. 

Here's the event handler: 

0 Kudos
1 Reply
ReneRubalcava
Frequent Contributor

Ah, saw and put an answer to your question on the GIS stack

arcgis javascript api - GraphicsLayer not redrawing visually while a Graphic is being dragged (JS AP... 

Maybe drag isn't the correct event to work with here. I got it to work with pointer-move.

0 Kudos