mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2024-12-23 14:02:50 -05:00
review comments
This commit is contained in:
parent
8622bfab69
commit
64686feb8b
1 changed files with 5 additions and 5 deletions
|
@ -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 () {
|
||||||
|
|
Loading…
Reference in a new issue