Skip to content

Fix field names in Transform #72

Closed
@artemisSystem

Description

@artemisSystem

Transform currently looks like this:

type Transform =
  { m11 :: Number
  , m12 :: Number
  , m21 :: Number
  , m22 :: Number
  , m31 :: Number
  , m32 :: Number
  }

It doesn't cause any problems currently, because the arguments are just passed in order to ctx.transform and ctx.setTransform. But, the names of the last two fields are wrong, which can lead to confusion.

In setTransform and transform (MDN docs links), they are primarily referred to as a, b, c, d, e, f, but also as m11, m12, m21, m22, dx, dy.

Also, ctx.getTransform returns a DOMMatrix, whose docs page mentions that e and f are equivalent to m41 and m42 respectively, and that m31 and m32 mean something completely different, relating to 3D transformations.

I remember talking briefly about this in Slack with Phil a while ago, but forgot to open an issue/PR for it.

I think the best solution would be to change Transform to look like this:

type Transform =
  { a :: Number
  , b :: Number
  , c :: Number
  , d :: Number
  , e :: Number
  , f :: Number
  }

Would this be reasonable to have as a breaking change for 0.14? I can make a PR for it if wanted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    purs-0.15A reminder to address this issue or merge this PR before we release PureScript v0.15.0type: breaking changeA change that requires a major version bump.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions