I am trying to figure out a way to disable the Sketch widget at certain scales.
Currently I have working code that will completely add or remove the widget, but that does not meet my requirements.
I see that the Sketch widget has a "state" property, but it is read only and I can find no methods or other properties to affect the state.
I need to be able to disable the entire widget or at least disable all the draw/editing tools.
One way to disable the buttons of the widget is by setting
pointer-events
style property tonone
.So, let say your widget variable is
sketch
, thenwhere
no-click
is just,I am not sure of your implementation, but I think you can get an idea with this snippets.
It is important that the widget is loaded before calling
getElementsByTagName
, if not you will get 0 result.