@meta2d/core 1.0.63 → 1.0.64
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/package.json +1 -1
- package/src/canvas/canvas.d.ts +1 -1
- package/src/canvas/canvas.js +36 -24
- package/src/canvas/canvas.js.map +1 -1
- package/src/canvas/canvasTemplate.d.ts +1 -0
- package/src/canvas/canvasTemplate.js +8 -2
- package/src/canvas/canvasTemplate.js.map +1 -1
- package/src/core.js +4 -3
- package/src/core.js.map +1 -1
package/package.json
CHANGED
package/src/canvas/canvas.d.ts
CHANGED
|
@@ -129,7 +129,7 @@ export declare class Canvas {
|
|
|
129
129
|
listen(): void;
|
|
130
130
|
onCopy: (event: ClipboardEvent) => void;
|
|
131
131
|
onCut: (event: ClipboardEvent) => void;
|
|
132
|
-
onPaste: (event: ClipboardEvent) => void
|
|
132
|
+
onPaste: (event: ClipboardEvent) => Promise<void>;
|
|
133
133
|
onMessage: (e: MessageEvent) => void;
|
|
134
134
|
onwheel: (e: WheelEvent) => void;
|
|
135
135
|
onkeydown: (e: KeyboardEvent) => void;
|
package/src/canvas/canvas.js
CHANGED
|
@@ -285,7 +285,7 @@ export class Canvas {
|
|
|
285
285
|
}
|
|
286
286
|
this.cut();
|
|
287
287
|
};
|
|
288
|
-
onPaste = (event) => {
|
|
288
|
+
onPaste = async (event) => {
|
|
289
289
|
if (this.store.data.locked || this.store.options.disableClipboard) {
|
|
290
290
|
return;
|
|
291
291
|
}
|
|
@@ -316,29 +316,39 @@ export class Canvas {
|
|
|
316
316
|
const blob = items[i].getAsFile();
|
|
317
317
|
let name = items[i].type.slice(6) === 'gif' ? 'gif' : 'image';
|
|
318
318
|
if (blob !== null) {
|
|
319
|
-
|
|
320
|
-
const
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
319
|
+
const isGif = name === 'gif';
|
|
320
|
+
const pen = await this.fileToPen(blob, isGif);
|
|
321
|
+
pen.height = (pen.height / pen.width) * 100,
|
|
322
|
+
pen.width = 100;
|
|
323
|
+
pen.x = x - 50 / 2,
|
|
324
|
+
pen.y = y - (pen.height / pen.width) * 50,
|
|
325
|
+
pen.externElement = isGif,
|
|
326
|
+
this.addPens([pen]);
|
|
327
|
+
this.active([pen]);
|
|
328
|
+
this.copy([pen]);
|
|
329
|
+
// let base64_str: any;
|
|
330
|
+
// const reader = new FileReader();
|
|
331
|
+
// reader.onload = (e) => {
|
|
332
|
+
// base64_str = e.target.result;
|
|
333
|
+
// const image = new Image();
|
|
334
|
+
// image.src = base64_str;
|
|
335
|
+
// image.onload = () => {
|
|
336
|
+
// const { width, height } = image;
|
|
337
|
+
// const pen = {
|
|
338
|
+
// name,
|
|
339
|
+
// x: x - 50 / 2,
|
|
340
|
+
// y: y - (height / width) * 50,
|
|
341
|
+
// externElement: name === 'gif',
|
|
342
|
+
// width: 100,
|
|
343
|
+
// height: (height / width) * 100,
|
|
344
|
+
// image: base64_str as any,
|
|
345
|
+
// };
|
|
346
|
+
// this.addPens([pen]);
|
|
347
|
+
// this.active([pen]);
|
|
348
|
+
// this.copy([pen]);
|
|
349
|
+
// };
|
|
350
|
+
// };
|
|
351
|
+
// reader.readAsDataURL(blob);
|
|
342
352
|
}
|
|
343
353
|
}
|
|
344
354
|
}
|
|
@@ -6171,6 +6181,7 @@ export class Canvas {
|
|
|
6171
6181
|
this.dropdown.style.background = pen.dropdownBackground || '#fff';
|
|
6172
6182
|
this.dropdown.style.color = pen.dropdownColor || '#bdc7db';
|
|
6173
6183
|
this.setDropdownList();
|
|
6184
|
+
this.externalElements.style.zIndex = '9999';
|
|
6174
6185
|
}
|
|
6175
6186
|
else {
|
|
6176
6187
|
// this.inputRight.style.display = 'none';
|
|
@@ -6353,6 +6364,7 @@ export class Canvas {
|
|
|
6353
6364
|
});
|
|
6354
6365
|
}
|
|
6355
6366
|
hideInput = () => {
|
|
6367
|
+
this.externalElements.style.zIndex = '5';
|
|
6356
6368
|
if (this.inputParent.style.display === 'flex') {
|
|
6357
6369
|
this.inputParent.style.display = 'none';
|
|
6358
6370
|
const pen = this.store.pens[this.inputDiv.dataset.penId];
|