|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
895 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | exports.type = 'perItem';
|
|---|
| 4 |
|
|---|
| 5 | exports.active = true;
|
|---|
| 6 |
|
|---|
| 7 | exports.description = 'converts non-eccentric <ellipse>s to <circle>s';
|
|---|
| 8 |
|
|---|
| 9 | /**
|
|---|
| 10 | * Converts non-eccentric <ellipse>s to <circle>s.
|
|---|
| 11 | *
|
|---|
| 12 | * @see http://www.w3.org/TR/SVG/shapes.html
|
|---|
| 13 | *
|
|---|
| 14 | * @param {Object} item current iteration item
|
|---|
| 15 | * @return {Boolean} if false, item will be filtered out
|
|---|
| 16 | *
|
|---|
| 17 | * @author Taylor Hunt
|
|---|
| 18 | */
|
|---|
| 19 | exports.fn = function(item) {
|
|---|
| 20 | if (item.isElem('ellipse')) {
|
|---|
| 21 | var rx = item.attr('rx').value || 0;
|
|---|
| 22 | var ry = item.attr('ry').value || 0;
|
|---|
| 23 |
|
|---|
| 24 | if (rx === ry ||
|
|---|
| 25 | rx === 'auto' || ry === 'auto' // SVG2
|
|---|
| 26 | ) {
|
|---|
| 27 | var radius = rx !== 'auto' ? rx : ry;
|
|---|
| 28 | item.renameElem('circle');
|
|---|
| 29 | item.removeAttr(['rx', 'ry']);
|
|---|
| 30 | item.addAttr({
|
|---|
| 31 | name: 'r',
|
|---|
| 32 | value: radius,
|
|---|
| 33 | prefix: '',
|
|---|
| 34 | local: 'r',
|
|---|
| 35 | });
|
|---|
| 36 | }
|
|---|
| 37 | }
|
|---|
| 38 | return;
|
|---|
| 39 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.