@onyx-p/imlib-web 2.5.4 → 2.5.5

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.
package/index.esm.js CHANGED
@@ -28628,11 +28628,11 @@ const getThumbnail = (img, thumbnailConfig) => {
28628
28628
  const canvas = document.createElement('canvas');
28629
28629
  const context = canvas.getContext('2d');
28630
28630
  const pos = calcPosition(img.width, img.height, thumbnailConfig);
28631
- canvas.width = pos.w > thumbnailConfig.maxWidth ? thumbnailConfig.maxWidth : pos.w;
28632
- canvas.height = pos.h > thumbnailConfig.maxHeight ? thumbnailConfig.maxHeight : pos.h;
28631
+ canvas.width = pos.w;
28632
+ canvas.height = pos.h;
28633
28633
  context.fillStyle = '#FFFFFF';
28634
28634
  context.fillRect(0, 0, canvas.width, canvas.height);
28635
- context?.drawImage(img, pos.x, pos.y, pos.w, pos.h);
28635
+ context?.drawImage(img, 0, 0, pos.w, pos.h);
28636
28636
  try {
28637
28637
  let base64 = canvas.toDataURL('image/jpeg', thumbnailConfig.quality);
28638
28638
  return dataURL2Blob(base64);
package/index.umd.js CHANGED
@@ -28634,11 +28634,11 @@
28634
28634
  const canvas = document.createElement('canvas');
28635
28635
  const context = canvas.getContext('2d');
28636
28636
  const pos = calcPosition(img.width, img.height, thumbnailConfig);
28637
- canvas.width = pos.w > thumbnailConfig.maxWidth ? thumbnailConfig.maxWidth : pos.w;
28638
- canvas.height = pos.h > thumbnailConfig.maxHeight ? thumbnailConfig.maxHeight : pos.h;
28637
+ canvas.width = pos.w;
28638
+ canvas.height = pos.h;
28639
28639
  context.fillStyle = '#FFFFFF';
28640
28640
  context.fillRect(0, 0, canvas.width, canvas.height);
28641
- context?.drawImage(img, pos.x, pos.y, pos.w, pos.h);
28641
+ context?.drawImage(img, 0, 0, pos.w, pos.h);
28642
28642
  try {
28643
28643
  let base64 = canvas.toDataURL('image/jpeg', thumbnailConfig.quality);
28644
28644
  return dataURL2Blob(base64);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onyx-p/imlib-web",
3
- "version": "2.5.4",
3
+ "version": "2.5.5",
4
4
  "main": "index.umd.js",
5
5
  "module": "index.esm.js",
6
6
  "types": "types/index.d.ts",