Sensible defaults

This commit is contained in:
Andreas Hocevar
2021-02-06 12:04:31 +01:00
parent bf90ce2789
commit d31abd2f77
3 changed files with 10 additions and 8 deletions

View File

@@ -128,9 +128,8 @@ const ModifyEventType = {
* provided, a vector source must be provided with the `source` option.
* @property {boolean} [wrapX=false] Wrap the world horizontally on the sketch
* overlay.
* @property {boolean} [snapToPointer=false] The vertex, point or segment being modified snaps to the
* pointer coordinate when clicked within the `pixelTolerance`. Setting this to `true` is recommended
* when the `Snap` interaction is used and the source geometry is not a snap target.
* @property {boolean} [snapToPointer=!hitDetection] The vertex, point or segment being modified snaps to the
* pointer coordinate when clicked within the `pixelTolerance`.
*/
/**
@@ -393,7 +392,10 @@ class Modify extends PointerInteraction {
/**
* @private
*/
this.snapToPointer_ = options.snapToPointer || false;
this.snapToPointer_ =
options.snapToPointer === undefined
? !this.hitDetection_
: options.snapToPointer;
}
/**