tokimeki-image-editor 0.1.4 → 0.1.6

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.
@@ -214,17 +214,21 @@ function handleComplete() {
214
214
  if (!state.imageData.original || !onComplete)
215
215
  return;
216
216
  const exportCanvas = applyTransform(state.imageData.original, state.transform, state.adjustments, state.cropArea, state.blurAreas, state.stampAreas);
217
+ const format = state.exportOptions.format === 'jpeg' ? 'image/jpeg' : 'image/png';
217
218
  const dataUrl = exportCanvas.toDataURL(state.exportOptions.format === 'jpeg' ? 'image/jpeg' : 'image/png', state.exportOptions.quality);
218
219
  // Convert to blob
219
220
  exportCanvas.toBlob((blob) => {
220
221
  if (blob) {
221
- onComplete(dataUrl, {
222
- blob: blob,
223
- width: exportCanvas.width,
224
- height: exportCanvas.height
222
+ createImageBitmap(blob).then((bitmap) => {
223
+ onComplete(dataUrl, {
224
+ blob: blob,
225
+ width: bitmap.width,
226
+ height: bitmap.height
227
+ });
228
+ bitmap.close();
225
229
  });
226
230
  }
227
- }, state.exportOptions.format === 'jpeg' ? 'image/jpeg' : 'image/png', state.exportOptions.quality);
231
+ }, format, state.exportOptions.quality);
228
232
  }
229
233
  function handleCancel() {
230
234
  if (onCancel) {
@@ -3,7 +3,11 @@ interface Props {
3
3
  width?: number;
4
4
  height?: number;
5
5
  isStandalone?: boolean;
6
- onComplete?: (dataUrl: string, blob: Blob) => void;
6
+ onComplete?: (dataUrl: string, blobObj: {
7
+ blob: Blob;
8
+ width: number;
9
+ height: number;
10
+ }) => void;
7
11
  onCancel?: () => void;
8
12
  onExport?: (dataUrl: string) => void;
9
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tokimeki-image-editor",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "A image editor for svelte.",
5
5
  "type": "module",
6
6
  "license": "MIT",