Bring in adroitwhiz's changes

This commit is contained in:
DD Liu 2020-05-06 22:57:11 -04:00
parent 33659f1d16
commit c6d5d892cf
3 changed files with 10 additions and 10 deletions

View file

@ -1,6 +1,6 @@
.paper-canvas {
top: 1px; /* leave room for the border*/
left: 1px;
top: 1px; /* leave room for the border */
left: 1px;
width: calc(100% - 2px);
height: calc(100% - 2px);
margin: auto;

View file

@ -228,7 +228,12 @@ class PaperCanvas extends React.Component {
window.setTimeout(() => {
// Detached
if (!paper.view) return;
paper.view.setViewSize(paper.DomElement.getSize(paper.view.element));
// Prevent blurriness caused if the "CSS size" of the element is a float--
// setting canvas dimensions to floats floors them, but we need to round instead
const elemSize = paper.DomElement.getSize(paper.view.element);
elemSize.width = Math.round(elemSize.width);
elemSize.height = Math.round(elemSize.height);
paper.view.setViewSize(elemSize);
paperCanvas.props.updateViewBounds(paper.view.matrix);
paperCanvas.initializeSvg(item, rotationCenterX, rotationCenterY, viewBox);
}, 0);

View file

@ -65,13 +65,8 @@ const getBackgroundGuideLayer = function () {
};
const _convertLayer = function (layer, format) {
if (isVector(format)) {
layer.vectorBackground.visible = true;
layer.bitmapBackground.visible = false;
} else if (isBitmap(format)) {
layer.bitmapBackground.visible = true;
layer.vectorBackground.visible = false;
}
layer.bitmapBackground.visible = isBitmap(format);
layer.vectorBackground.visible = isVector(format);
};
const convertBackgroundGuideLayer = function (format) {