Skip to content

Commit 6be5903

Browse files
committed
rant in desc, but revert this for now
I originally was told about a bug in paper.js by Cryptid, and this was meant to fix that. Apparently, this only fixes the bug in render time and does not fix the real problem. After this commit, people in the TW server called me lazy and said I "fucked it up" when it was easy for trying to fix a bug. I did not know how to actually fix the issue so I've left this in PM since then. Even today, no one there has told me how to fix it once even after I asked so I'm going to figure it out myself. This reverts commit 95e9c0e.
1 parent cf270fb commit 6be5903

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

src/containers/paper-canvas.jsx

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ class PaperCanvas extends React.Component {
222222
// the viewBox to start at (0, 0), and we need to translate it back for some costumes to render
223223
// correctly.
224224
const parser = new DOMParser();
225-
const serializer = new XMLSerializer();
226225
const svgDom = parser.parseFromString(svg, 'text/xml');
227226
const viewBox = svgDom.documentElement.attributes.viewBox ?
228227
svgDom.documentElement.attributes.viewBox.value.match(/\S+/g) : null;
@@ -232,23 +231,7 @@ class PaperCanvas extends React.Component {
232231
}
233232
}
234233

235-
// pm: Currently paper.js doesn't parse rx or ry attributes if the other isn't present.
236-
const elements = svgDom.querySelectorAll('[rx], [ry]');
237-
238-
elements.forEach(el => {
239-
if (!el.hasAttribute('ry') && el.hasAttribute('rx')) {
240-
const rxValue = el.getAttribute('rx');
241-
el.setAttribute('ry', rxValue);
242-
} else if (!el.hasAttribute('rx') && el.hasAttribute('ry')) {
243-
const ryValue = el.getAttribute('ry');
244-
el.setAttribute('rx', ryValue);
245-
}
246-
});
247-
248-
// pm: We modified the svg, unlike TW
249-
const modifiedSvg = serializer.serializeToString(svgDom);
250-
251-
paper.project.importSVG(modifiedSvg, {
234+
paper.project.importSVG(svg, {
252235
expandShapes: true,
253236
insert: false,
254237
onLoad: function (item) {

0 commit comments

Comments
 (0)