mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-28 08:38:11 +08:00
Replace the image layer type with an Image node (#948)
* Use builder pattern for widgets * Arguments to new function * Add node graph when dragging in image * Fix duplicate import * Skip processing under node graph frame if unused * Reduce node graph rerenders * DUPLICATE ALL frontend changes into other frontend * DUPLICATE more changes to another frontend * Code review * Allow importing SVG files as bitmaps Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
committed by
Keavon Chambers
co-authored by
Keavon Chambers
parent
d541cf9932
commit
41bb1a8170
@@ -2,7 +2,7 @@
|
||||
import { getContext, onMount, tick } from "svelte";
|
||||
|
||||
import { textInputCleanup } from "@/utility-functions/keyboard-entry";
|
||||
import { rasterizeSVGCanvas } from "@/utility-functions/rasterization";
|
||||
import { extractPixelData, rasterizeSVGCanvas } from "@/utility-functions/rasterization";
|
||||
import {
|
||||
type MouseCursorIcon,
|
||||
type XY,
|
||||
@@ -82,10 +82,9 @@
|
||||
Array.from(dataTransfer.items).forEach(async (item) => {
|
||||
const file = item.getAsFile();
|
||||
if (file?.type.startsWith("image")) {
|
||||
const buffer = await file.arrayBuffer();
|
||||
const u8Array = new Uint8Array(buffer);
|
||||
const imageData = await extractPixelData(file);
|
||||
|
||||
editor.instance.pasteImage(file.type, u8Array, e.clientX, e.clientY);
|
||||
editor.instance.pasteImage(new Uint8Array(imageData.data), imageData.width, imageData.height, e.clientX, e.clientY);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user