Skip to content

adding missing setTransform method #52

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
Oct 5, 2017
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
9 changes: 9 additions & 0 deletions src/Graphics/Canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,15 @@ exports.transform = function(t) {
};
};

exports.setTransform = function(t) {
return function(ctx) {
return function() {
ctx.setTransform(t.m11, t.m12, t.m21, t.m22, t.m31, t.m32);
return ctx;
};
};
};

exports.clearRect = function(ctx) {
return function(r) {
return function() {
Expand Down
5 changes: 4 additions & 1 deletion src/Graphics/Canvas.purs
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,12 @@ type Transform =
, m32 :: Number
}

-- | Apply a general transformation.
-- | Apply a general transformation to the current transformation matrix
foreign import transform :: forall eff. Transform -> Context2D -> Eff (canvas :: CANVAS | eff) Context2D

-- | Set the transformation matrix
foreign import setTransform :: forall eff. Transform -> Context2D -> Eff (canvas :: CANVAS | eff) Context2D

-- | Enumerates types of text alignment.
data TextAlign
= AlignLeft | AlignRight | AlignCenter | AlignStart | AlignEnd
Expand Down