Skip to content

Commit 575f286

Browse files
yilinweipaf31
authored andcommitted
adding missing setTransform method (#52)
1 parent de2ba35 commit 575f286

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/Graphics/Canvas.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,15 @@ exports.transform = function(t) {
314314
};
315315
};
316316

317+
exports.setTransform = function(t) {
318+
return function(ctx) {
319+
return function() {
320+
ctx.setTransform(t.m11, t.m12, t.m21, t.m22, t.m31, t.m32);
321+
return ctx;
322+
};
323+
};
324+
};
325+
317326
exports.clearRect = function(ctx) {
318327
return function(r) {
319328
return function() {

src/Graphics/Canvas.purs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,9 +476,12 @@ type Transform =
476476
, m32 :: Number
477477
}
478478

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

482+
-- | Set the transformation matrix
483+
foreign import setTransform :: forall eff. Transform -> Context2D -> Eff (canvas :: CANVAS | eff) Context2D
484+
482485
-- | Enumerates types of text alignment.
483486
data TextAlign
484487
= AlignLeft | AlignRight | AlignCenter | AlignStart | AlignEnd

0 commit comments

Comments
 (0)