Skip to content

Commit

Permalink
fix: disable all image smoothing
Browse files Browse the repository at this point in the history
  • Loading branch information
kylehue committed Mar 28, 2024
1 parent f3253d8 commit ba8ecaf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/components/material-manager-item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ const isVerticallyFlipped = ref(
);
async function handleDuplicateMaterial() {
const duplicatedMaterial = await projectStore.duplicateMaterial(props.material);
const duplicatedMaterial = await projectStore.duplicateMaterial(
props.material
);
if (!duplicatedMaterial) return;
projectStore.saveState(
"material-duplicate",
Expand Down Expand Up @@ -422,3 +424,9 @@ watch(isVerticallyFlipped, () => {
handleMaterialChangeVerticallyFlipped();
});
</script>

<style scoped lang="scss">
img {
image-rendering: pixelated;
}
</style>
1 change: 1 addition & 0 deletions src/designer/Designer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ export class Designer {
x: tx,
y: ty,
} = this.getTransformedImageInfo(material);
ctx.imageSmoothingEnabled = false;
ctx.drawImage(image, x + tx, y + ty);
}
if (this.settingsStore.designerArea.showMatrixId) {
Expand Down
1 change: 1 addition & 0 deletions src/panes/material-area/material-item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ function handleRightClick(e: MouseEvent) {
img {
user-select: none !important;
image-rendering: pixelated;
}
}
</style>
2 changes: 1 addition & 1 deletion src/utils/MaterialTexture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ export class MaterialTexture {
this.imageCanvas.width = rotatedWidth;
this.imageCanvas.height = rotatedHeight;

this.ctx.imageSmoothingEnabled = false;
this.ctx.save();
this.ctx.translate(rotatedWidth / 2, rotatedHeight / 2);
this.ctx.rotate(angle);
this.ctx.scale(
this.isHorizontallyFlipped ? -1 : 1,
this.isVerticallyFlipped ? -1 : 1
);
this.ctx.imageSmoothingEnabled = false;
this.ctx.drawImage(
this.origImageCanvas,
-origWidth / 2,
Expand Down

0 comments on commit ba8ecaf

Please sign in to comment.