Skip to content

consider allowing Point to be expressed as [number, number] #110

@ianstormtaylor

Description

@ianstormtaylor

I noticed that in the test files this pattern is already used, with inline poly and line helpers defined. It would be really nice to be able to use this out of the box, because defining polygons or lines gets tedious having to do new Point(...), new Point(...), new Point(...) manually.

Some actual code of mine:

let poly = new Polygon(
  new Point(rx, rh),
  new Point(lx, lh),
  new Point(lx, ly),
  new Point(rx, ry)
)

Would be nicely simplified to:

let poly = new Polygon(
  [rx, rh],
  [lx, lh],
  [lx, ly],
  [rx, ry]
)

It seems like this would be a variant of SimplePoint, as a tuple instead of an object?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions