Node macro lambda parameters (#1309)

* Implement parsing of impl Node<I, …> syntax for the macro

* Extend node macro to allow specifying lambda nodes
This commit is contained in:
Dennis Kobert
2023-06-09 16:43:46 +02:00
committed by GitHub
parent 6ee9e20e4c
commit cf1d294013
15 changed files with 109 additions and 106 deletions
+3 -3
View File
@@ -1,6 +1,6 @@
/* eslint-disable max-classes-per-file */
import {writable} from "svelte/store";
import { writable } from "svelte/store";
import { downloadFileText, downloadFileBlob, upload, downloadFileURL } from "@graphite/utility-functions/files";
import { extractPixelData, imageToPNG, rasterizeSVG, rasterizeSVGCanvas } from "@graphite/utility-functions/rasterization";
@@ -98,7 +98,7 @@ export function createPortfolioState(editor: Editor) {
});
});
editor.subscriptions.subscribeJsMessage(TriggerRasterizeRegionBelowLayer, async (triggerRasterizeRegionBelowLayer) => {
const { documentId, layerPath, svg, size, imaginateNodePath } = triggerRasterizeRegionBelowLayer;
const { documentId, layerPath, svg, size } = triggerRasterizeRegionBelowLayer;
// Rasterize the SVG to an image file
try {
@@ -106,7 +106,7 @@ export function createPortfolioState(editor: Editor) {
const imageData = (await rasterizeSVGCanvas(svg, size[0], size[1])).getContext("2d")?.getImageData(0, 0, size[0], size[1]);
if (!imageData) return;
editor.instance.renderGraphUsingRasterizedRegionBelowLayer(documentId, layerPath, new Uint8Array(imageData.data), imageData.width, imageData.height, imaginateNodePath);
editor.instance.renderGraphUsingRasterizedRegionBelowLayer(documentId, layerPath, new Uint8Array(imageData.data), imageData.width, imageData.height);
}
}
// getImageData may throw an exception if the resolution is too high
+1 -3
View File
@@ -545,8 +545,6 @@ export class TriggerRasterizeRegionBelowLayer extends JsMessage {
readonly svg!: string;
readonly size!: [number, number];
readonly imaginateNodePath!: BigUint64Array | undefined;
}
export class TriggerRefreshBoundsOfViewports extends JsMessage { }
@@ -700,7 +698,7 @@ export class ImaginateImageData {
readonly imageData!: Uint8Array;
readonly transform!: Float64Array ;
readonly transform!: Float64Array;
}
export class DisplayDialogDismiss extends JsMessage { }