Closed IAfanasov closed 4 years ago
So, the quick answer is to use the draw.modechange event revert back to the state you want the user to be in.
The long answer is that this might be a really good mode modifier function. With custom modes now live, one could write a module that wraps a mode in a validation check.
var defaultDirectSelectMode = MapboxDraw.modes.directSelect;
var validator = require('mapbox-gl-draw-validate-features'); // what needs to be written
var validatorDirectSelectMode = validator(defaultDirectSelectMode, function(some, args) {
return false; // stay in the same mode
return true; // continue changing the mode
});
If this was written and published to npm, I'd love to put it in the custom modes docs
closing because this is not currently actionable
I had scenario with validation. User should choose the polygon and fill it's properties. Like name, year and etc. This properties should be validated. I want to disallow user to select other object or clear selection before she correct all validation issues.