-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change adds a separate Symbol tag class since the element should be treated slightly different from a Group, namely in that a vewBox can be applied. Additionally, a Symbol is like a def in that it should not be rendered until referenced by a Use element. fixes #58
- Loading branch information
Showing
2 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
/** | ||
* @package php-svg-lib | ||
* @link http://github.com/PhenX/php-svg-lib | ||
* @author Fabien Ménager <[email protected]> | ||
* @license GNU LGPLv3+ http://www.gnu.org/copyleft/lesser.html | ||
*/ | ||
|
||
namespace Svg\Tag; | ||
|
||
use Svg\Style; | ||
|
||
class Symbol extends AbstractTag | ||
{ | ||
protected function before($attributes) | ||
{ | ||
$surface = $this->document->getSurface(); | ||
|
||
$surface->save(); | ||
|
||
$style = $this->makeStyle($attributes); | ||
|
||
$this->setStyle($style); | ||
$surface->setStyle($style); | ||
|
||
$this->applyViewbox($attributes); | ||
$this->applyTransform($attributes); | ||
} | ||
|
||
protected function after() | ||
{ | ||
$this->document->getSurface()->restore(); | ||
} | ||
} |