review comments

This commit is contained in:
DD 2018-04-12 14:27:07 -04:00
parent 8622bfab69
commit 64686feb8b

View file

@ -95,22 +95,22 @@ class PaperCanvas extends React.Component {
// Get rid of anti-aliasing // Get rid of anti-aliasing
// @todo get crisp text? // @todo get crisp text?
svg.setAttribute('shape-rendering', 'optimizeSpeed'); svg.setAttribute('shape-rendering', 'crispEdges');
const svgString = (new XMLSerializer()).serializeToString(svg); const svgString = (new XMLSerializer()).serializeToString(svg);
// Put anti-aliased SVG into image, and dump image back into canvas // Put anti-aliased SVG into image, and dump image back into canvas
const img = new Image(); const img = new Image();
img.onload = function () { img.onload = () => {
const raster = new paper.Raster(img); const raster = new paper.Raster(img);
raster.onLoad = function () { raster.onLoad = () => {
const subCanvas = raster.canvas; const subCanvas = raster.canvas;
getRaster().drawImage( getRaster().drawImage(
subCanvas, subCanvas,
new paper.Point(Math.floor(bounds.topLeft.x), Math.floor(bounds.topLeft.y))); new paper.Point(Math.floor(bounds.topLeft.x), Math.floor(bounds.topLeft.y)));
paper.project.activeLayer.removeChildren(); paper.project.activeLayer.removeChildren();
this.props.onUpdateSvg(); this.props.onUpdateSvg();
}.bind(this); };
}.bind(this); };
img.src = `data:image/svg+xml;charset=utf-8,${svgString}`; img.src = `data:image/svg+xml;charset=utf-8,${svgString}`;
} }
convertToVector () { convertToVector () {