origo-map / multiselect-plugin

Multiselect plugin for Origo
MIT License
2 stars 10 forks source link

Enables line-selection functionality #6

Closed sweco-sefaed closed 3 years ago

sweco-sefaed commented 3 years ago

Fixes #5

Line has a buffer which it uses to compare versus intersecting points. The line buffer factor can be specified when initialized with the Origo map.

lineselect

Grammostola commented 3 years ago

Tested with latest origo-map/origo , does what it says on the tin : )

The only really tiny thing I noticed was that if you init the plugin with var multiselect = Multiselect({ lineBufferFactor: 0 }) or a negative number it will crash (when line-selecting).

let lineBufferFactor = Object.prototype.hasOwnProperty.call(options, 'lineBufferFactor') ? options.lineBufferFactor : 1; if (lineBufferFactor <= 0) { lineBufferFactor = 1; }

seems to fix it and can probably be written prettierly :) It's uncertain if even needed because using a minus BufferFactor seems counterintuitive. I suppose someone might try 0 though. It depends a bit on the given documentation.

sweco-sefaed commented 3 years ago

All lineBufferFactor values below 1 will now force it to 1. Recommended values would be 2 or 3.