terra-draw icon indicating copy to clipboard operation
terra-draw copied to clipboard

[Feature Request] Allow snapping for LineStrings and Polygon features in select mode

Open bochkov-vi opened this issue 1 year ago • 2 comments

maybe this is possible in the current version

bochkov-vi avatar Oct 11 '24 14:10 bochkov-vi

Hey, thanks for the question. Can you clarify what you mean here exactly? If you mean snapping LineStrings and Polygons in Select mode then that is not currently supported.

JamesLMilner avatar Oct 11 '24 18:10 JamesLMilner

yes, you understood correctly, it is a pity that there is no such feature

bochkov-vi avatar Oct 12 '24 06:10 bochkov-vi

@bochkov-vi we are now able to snap for polygons created in TerraDrawPolygonMode and linestrings created in TerraDrawLineString mode, when using TerraDrawSelectMode. You can configure the snappable flag for select mode like so:

new TerraDrawSelectMode({
  projection: "web-mercator",
  flags: {
    polygon: {
      feature: {
        coordinates: {
          snappable: {
            toLine: true,
            toCoordinate: true
          },
        }
      }
    },
    linestring: {
      feature: {
        coordinates: {
          snappable: {
            toLine: true,
            toCoordinate: true
          },
        }
      }
    }
  }
})

It is now available as part of version 1.8.0

JamesLMilner avatar Jun 15 '25 12:06 JamesLMilner