Select to view content in your preferred language

UpdateOverlay in MapTool not working with text graphics

795
3
Jump to solution
08-18-2022 06:03 PM
RichardOxales
Occasional Contributor

I'm creating a Map Tool that displays a preview graphic drawn that follows the mouse. It will include some text that moves along with it displaying the measured length. The text displays fine when it's first added using AddOverlay and using the geometry of the feature I'll be placing (in this case, a line), however, using UpdateOverlay with new geometry makes the text look like the geometry of the feature instead of text.

With a line for example, UpdateOverlay makes the text looks like a thin black line on top of the red line being placed:

RichardOxales_1-1660870806643.png

 

This is the effect I'd like to achieve:

RichardOxales_0-1660870730058.png

I can make the text display properly by disposing and re-adding the graphic into the overlay when the user moves their mouse, but this causes the text to flicker while the mouse is moving, which isn't ideal. The red line does not flicker when using UpdateOverlay. Both, the line and text, use the same geometry for the update.

Is there currently a way around this?

0 Kudos
1 Solution

Accepted Solutions
Wolf
by Esri Regular Contributor
Esri Regular Contributor

@RichardOxales thanks for pointing this out.  I tried a few workarounds for this issue and the only one that i deem acceptable is using an embedded [overlay] control in the tool that does the mouse move tracking.  However, the UI will look a bit different, but on the other hand is easier to read:

Wolf_0-1661361523048.png

There is no screen flashing (caused by delete/add of text graphics).

Wolf_1-1661361599151.png

I attached my sample code.

 

View solution in original post

0 Kudos
3 Replies
CharlesMacleod
Esri Regular Contributor

Richard, this is definitely a bug. We'll try to get this addressed for 3.1. The workaround would be to delete and re-add which I realize is not optimal.

0 Kudos
Wolf
by Esri Regular Contributor
Esri Regular Contributor

@RichardOxales thanks for pointing this out.  I tried a few workarounds for this issue and the only one that i deem acceptable is using an embedded [overlay] control in the tool that does the mouse move tracking.  However, the UI will look a bit different, but on the other hand is easier to read:

Wolf_0-1661361523048.png

There is no screen flashing (caused by delete/add of text graphics).

Wolf_1-1661361599151.png

I attached my sample code.

 

0 Kudos
RichardOxales
Occasional Contributor

Thanks for the suggestion, I'll go with this for the time being.

0 Kudos