mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-25 02:18:12 +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
66e8325362
commit
64e62699fc
@@ -22,6 +22,7 @@ crate-type = ["cdylib", "rlib"]
|
||||
editor = { path = "../../editor", package = "graphite-editor" }
|
||||
document-legacy = { path = "../../document-legacy", package = "graphite-document-legacy" }
|
||||
graph-craft = { path = "../../node-graph/graph-craft" }
|
||||
graphene-core = { path = "../../node-graph/gcore", features = ["async", "std", "alloc"] }
|
||||
log = "0.4"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
wasm-bindgen = { version = "0.2.73" }
|
||||
|
||||
@@ -660,9 +660,10 @@ impl JsEditorHandle {
|
||||
|
||||
/// Pastes an image
|
||||
#[wasm_bindgen(js_name = pasteImage)]
|
||||
pub fn paste_image(&self, mime: String, image_data: Vec<u8>, mouse_x: Option<f64>, mouse_y: Option<f64>) {
|
||||
pub fn paste_image(&self, image_data: Vec<u8>, width: u32, height: u32, mouse_x: Option<f64>, mouse_y: Option<f64>) {
|
||||
let mouse = mouse_x.and_then(|x| mouse_y.map(|y| (x, y)));
|
||||
let message = DocumentMessage::PasteImage { mime, image_data, mouse };
|
||||
let image = graphene_core::raster::Image::from_image_data(&image_data, width, height);
|
||||
let message = DocumentMessage::PasteImage { image, mouse };
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user