mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-23 02:18:11 +08:00
Pasting and duplicating nodes (#902)
* Pasting and duplicating nodes * Rebind duplication * Update selection on duplicate
This commit is contained in:
committed by
Keavon Chambers
parent
537dbf266a
commit
1f69b0f35f
@@ -300,7 +300,7 @@ import { defineComponent, nextTick } from "vue";
|
||||
|
||||
import type { IconName } from "@/utility-functions/icons";
|
||||
|
||||
import type { FrontendNodeLink } from "@/wasm-communication/messages";
|
||||
import { UpdateNodeGraphSelection, FrontendNodeLink } from "@/wasm-communication/messages";
|
||||
|
||||
import LayoutCol from "@/components/layout/LayoutCol.vue";
|
||||
import LayoutRow from "@/components/layout/LayoutRow.vue";
|
||||
@@ -721,6 +721,10 @@ export default defineComponent({
|
||||
const outputPort2 = document.querySelectorAll(`[data-port="output"]`)[6] as HTMLDivElement | undefined;
|
||||
const inputPort2 = document.querySelectorAll(`[data-port="input"]`)[3] as HTMLDivElement | undefined;
|
||||
if (outputPort2 && inputPort2) this.createWirePath(outputPort2, inputPort2.getBoundingClientRect(), true, false);
|
||||
|
||||
this.editor.subscriptions.subscribeJsMessage(UpdateNodeGraphSelection, (updateNodeGraphSelection) => {
|
||||
this.selected = updateNodeGraphSelection.selected;
|
||||
});
|
||||
},
|
||||
components: {
|
||||
IconLabel,
|
||||
|
||||
@@ -262,6 +262,8 @@ export function createInputManager(editor: Editor, container: HTMLElement, dialo
|
||||
item.getAsString((text) => {
|
||||
if (text.startsWith("graphite/layer: ")) {
|
||||
editor.instance.pasteSerializedData(text.substring(16, text.length));
|
||||
} else if (text.startsWith("graphite/nodes: ")) {
|
||||
editor.instance.pasteSerializedNodes(text.substring(16, text.length));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -33,11 +33,17 @@ export class UpdateNodeGraph extends JsMessage {
|
||||
@Type(() => FrontendNodeLink)
|
||||
readonly links!: FrontendNodeLink[];
|
||||
}
|
||||
|
||||
export class UpdateNodeTypes extends JsMessage {
|
||||
@Type(() => FrontendNode)
|
||||
readonly nodeTypes!: FrontendNodeType[];
|
||||
}
|
||||
|
||||
export class UpdateNodeGraphSelection extends JsMessage {
|
||||
@Type(() => BigInt)
|
||||
readonly selected!: bigint[];
|
||||
}
|
||||
|
||||
export class UpdateNodeGraphVisibility extends JsMessage {
|
||||
readonly visible!: boolean;
|
||||
}
|
||||
@@ -1407,6 +1413,7 @@ export const messageMakers: Record<string, MessageMaker> = {
|
||||
UpdateMouseCursor,
|
||||
UpdateNodeGraph,
|
||||
UpdateNodeGraphBarLayout,
|
||||
UpdateNodeGraphSelection,
|
||||
UpdateNodeTypes,
|
||||
UpdateNodeGraphVisibility,
|
||||
UpdateOpenDocumentsList,
|
||||
|
||||
Reference in New Issue
Block a user