I had seen this post but it didn’t work like this when using webviewer in an angular / typescript environment because getTool returns a Tool object and not an object type with the setsnap method.
I did ultimately manage to do it with some ugly casting
const distanceMeasurementTool : Core.Tools.DistanceMeasurementCreateTool = documentViewer.getTool('AnnotationCreateDistanceMeasurement') as Core.Tools.DistanceMeasurementCreateTool;
But this doesn’t work.
When enabling snapping for measurement tools in the UI you have a visual orange feedback when you hover your mouse over lines, like this (bottom right of the measure) :
When setting snapMode, it doesn’t do anything like that, plus the UI control is not updated as you said yourself.
I’m sorry but it’s like you didn’t read my answer or I was not clear…
I did manage to make it work with some type casting but it doesn’t do anything. See what I said above.
Using setSnapMode (SnapModeS.DEFAULT) programatically doesn’t achieve the same result as ticking the box to enable snapping for measurement.
There was something interfering in my code because I declared the tool too early I think.
It works and I have a ticket opened to fix the UI to match this option when activated programatically.