Skip to content

Commit 406bad8

Browse files
authored
Merge pull request #44 from naitsirch/extend_rotate
Extended rotate transformation to support rotation about another point
2 parents 7fa076d + 140bd80 commit 406bad8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Svg/Tag/AbstractTag.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,14 @@ protected function applyTransform($attributes)
166166
break;
167167

168168
case "rotate":
169-
$surface->rotate($t[1]);
169+
if (isset($t[2])) {
170+
$t[3] = isset($t[3]) ? $t[3] : 0;
171+
$surface->translate($t[2], $t[3]);
172+
$surface->rotate($t[1]);
173+
$surface->translate(-$t[2], -$t[3]);
174+
} else {
175+
$surface->rotate($t[1]);
176+
}
170177
break;
171178

172179
case "skewX":

0 commit comments

Comments
 (0)