@novely/solid-renderer 0.35.1 → 0.35.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.jsx +9 -10
  2. package/package.json +1 -1
package/dist/index.jsx CHANGED
@@ -5118,8 +5118,8 @@ var canvasDrawImages = async (canvas = createCanvas(), ctx = getContext(canvas),
5118
5118
  const sizesSorted = images.slice().sort((a, b) => b.width - a.width);
5119
5119
  const sizes = sizesSorted[0];
5120
5120
  const scaleBy = canvas.dataset.scaleBy ? Number(canvas.dataset.scaleBy) : 1;
5121
- canvas.width = Math.min(sizes.naturalWidth * scaleBy * 2, sizes.naturalWidth);
5122
- canvas.height = Math.min(sizes.naturalHeight * scaleBy * 2, sizes.naturalHeight);
5121
+ canvas.width = Math.min(sizes.naturalWidth * scaleBy * 2, sizes.naturalWidth) * devicePixelRatio;
5122
+ canvas.height = Math.min(sizes.naturalHeight * scaleBy * 2, sizes.naturalHeight) * devicePixelRatio;
5123
5123
  canvas.dataset.resized = "true";
5124
5124
  }
5125
5125
  for (const image of images) {
@@ -6296,12 +6296,11 @@ var Game = (props) => {
6296
6296
  const {
6297
6297
  clientWidth,
6298
6298
  clientHeight
6299
- } = props.context.root;
6300
- const w = Math.ceil(Math.min(clientWidth, img.width));
6301
- const h = Math.ceil(Math.min(clientHeight, img.height));
6302
- canvas.width = w;
6303
- canvas.height = h;
6304
- ctx.drawImage(img, 0, 0, w, h);
6299
+ } = context.root;
6300
+ const maxFactor = 1 / Math.ceil(Math.max(img.width / clientWidth, img.height / clientHeight));
6301
+ canvas.width = Math.min(img.width * maxFactor, img.width) * devicePixelRatio;
6302
+ canvas.height = Math.min(img.height * maxFactor, img.height) * devicePixelRatio;
6303
+ ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
6305
6304
  }
6306
6305
  }
6307
6306
  }), _el$2);
@@ -7247,8 +7246,8 @@ var createSolidRenderer = ({
7247
7246
  const sizes = characterAssetSizes[character];
7248
7247
  if (sizes) {
7249
7248
  const scaleBy = canvas.dataset.scaleBy ? Number(canvas.dataset.scaleBy) : 1;
7250
- canvas.width = Math.min(sizes.width * scaleBy * 2, sizes.width);
7251
- canvas.height = Math.min(sizes.height * scaleBy * 2, sizes.height);
7249
+ canvas.width = Math.min(sizes.width * scaleBy * 2, sizes.width) * devicePixelRatio;
7250
+ canvas.height = Math.min(sizes.height * scaleBy * 2, sizes.height) * devicePixelRatio;
7252
7251
  canvas.dataset.resized = "true";
7253
7252
  }
7254
7253
  canvasDrawImages(canvas, canvasContext, stored);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@novely/solid-renderer",
3
- "version": "0.35.1",
3
+ "version": "0.35.2",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"