I would like to know how can I disable the right click on my TrackOverlay ?
I want to disable it because I have a context menu and when I right-click, the context menu is shown but it's also adding a vertex in the track shape layer !
And I also want to know how can I remove the last vertex added in the trackshapelayer ? I have this option in my context menu but I can't do it !
Thank Adolfo for your sharing and your suggestion is quite right.
Pierre, If you override the MouseDownCore, you can check the mouse button from the pass-in parameter interactionArguments, if it is right button, doesn’t do anything that can be disable the right click.
Please let me know if you need to more information about it.
The last vertex added is removed but nothing change in the trackshapelayer. And if I try to remove another vertex, I've got an exception (Argument out of range).
I have the following CustomTrackInteractiveOverlay and I use it to track lines at left click and remove the last vertex at right click. It is working just fine for tracking lines but if I try to do the same thing with tracking a polygon I have the same "out of bound" error. I think it should work as well for tracking polygons. I think that there is a bug. I communicated this to the Desktop team and we will see what they say. Thank you.
It's a bug that we have a private member variable which is used to track polygon, now you override some logic, so the value of it is not right but you can not update it as well.
I have tried many ways to find a workaround but I can not make it, so I added this to our Issue Tracking system, we will fix it later.
It shows the behavior you are looking for with a line. For having the same thing with polygon, it should be almost identical and you can have it working once the bug will be fixed. Thank you.
We have fixed the problem with version 3.1.398 that made the MouseDownCount as protected that we can support polygon, when you try to remove a vertex you need to subtract 1 for mouse down count. Here is updated code:
class CustomTrackInteractiveOverlay : TrackInteractiveOverlay { public CustomTrackInteractiveOverlay() : base() { }
protected override InteractiveResult MouseDownCore(InteractionArguments interactionArguments) { if (interactionArguments.MouseButton != MapMouseButton.Right) return base.MouseDownCore(interactionArguments); else RemoveLastVertexAdded(); return new InteractiveResult(); }
private void RemoveLastVertexAdded() { int minVertex = 0;
if (this.TrackMode == TrackMode.Line) minVertex = 2; else if (this.TrackMode == TrackMode.Polygon) minVertex = 3;