Skip to content

Change field names of Transform #86

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Notable changes to this project are documented in this file. The format is based
Breaking changes:
- Migrate FFI to ES modules (#85 by @JordanMartinez)
- Support arcs that are drawn counter-clockwise (#58, #83 by @karljs and @JordanMartinez)
- The `Transform` type now uses the field names `a`, `b`, `c`, `d`, `e` and `f`, instead of `m11`, `m12`, `m21`, `m22`, `m31` and `m32` (#86 by @artemisSystem)

New features:
- Added `createImageDataWith` (#81)
Expand Down
4 changes: 2 additions & 2 deletions src/Graphics/Canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,15 +291,15 @@ export function translate(ctx) {
export function transform(ctx) {
return function(t) {
return function() {
ctx.transform(t.m11, t.m12, t.m21, t.m22, t.m31, t.m32);
ctx.transform(t.a, t.b, t.c, t.d, t.e, t.f);
};
};
}

export function setTransform(ctx) {
return function(t) {
return function() {
ctx.setTransform(t.m11, t.m12, t.m21, t.m22, t.m31, t.m32);
ctx.setTransform(t.a, t.b, t.c, t.d, t.e, t.f);
};
};
}
Expand Down
12 changes: 6 additions & 6 deletions src/Graphics/Canvas.purs
Original file line number Diff line number Diff line change
Expand Up @@ -479,12 +479,12 @@ foreign import translate :: Context2D -> TranslateTransform -> Effect Unit

-- | An object representing a general transformation as a homogeneous matrix.
type Transform =
{ m11 :: Number
, m12 :: Number
, m21 :: Number
, m22 :: Number
, m31 :: Number
, m32 :: Number
{ a :: Number
, b :: Number
, c :: Number
, d :: Number
, e :: Number
, f :: Number
}

-- | Apply a general transformation to the current transformation matrix
Expand Down