mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 19:08:05 +08:00
Add icons
This commit is contained in:
@@ -587,7 +587,6 @@
|
||||
thumbPosition={scrollbarPos.x}
|
||||
on:trackShift={({ detail }) => editor.handle.panCanvasByFraction(detail, 0)}
|
||||
on:thumbPosition={({ detail }) => panCanvasX(detail)}
|
||||
on:thumbDragEnd={() => editor.handle.setGridAlignedEdges()}
|
||||
on:thumbDragStart={() => editor.handle.panCanvasAbortPrepare(true)}
|
||||
on:thumbDragAbort={() => editor.handle.panCanvasAbort(true)}
|
||||
/>
|
||||
|
||||
@@ -617,7 +617,6 @@
|
||||
<path class="visibility" d={pathString} />
|
||||
{/each}
|
||||
<path class="all-nodes-bounding-box" d={$nodeGraph.clickTargets.allNodesBoundingBox} />
|
||||
<path class="all-nodes-bounding-box" d={$nodeGraph.clickTargets.importExportsBoundingBox} />
|
||||
{#each $nodeGraph.clickTargets.modifyImportExport as pathString}
|
||||
<path class="modify-import-export" d={pathString} />
|
||||
{/each}
|
||||
|
||||
@@ -35,7 +35,6 @@ export class FrontendClickTargets {
|
||||
readonly connectorClickTargets!: string[];
|
||||
readonly iconClickTargets!: string[];
|
||||
readonly allNodesBoundingBox!: string;
|
||||
readonly importExportsBoundingBox!: string;
|
||||
readonly modifyImportExport!: string[];
|
||||
}
|
||||
|
||||
@@ -106,30 +105,10 @@ export class UpdateLayerWidths extends JsMessage {
|
||||
readonly layerWidths!: Map<bigint, number>;
|
||||
}
|
||||
|
||||
export class UpdateNodeGraphSvelteRender extends JsMessage {
|
||||
readonly nodesToRender!: FrontendNodeToRender[];
|
||||
|
||||
readonly open!: boolean;
|
||||
|
||||
readonly opacity!: number;
|
||||
|
||||
readonly inSelectedNetwork!: boolean;
|
||||
|
||||
readonly previewedNode!: bigint | undefined;
|
||||
}
|
||||
|
||||
export class UpdateShouldRenderSvelteNodes extends JsMessage {
|
||||
readonly shouldRenderSvelteNodes!: boolean;
|
||||
}
|
||||
|
||||
export class UpdateNativeNodeGraphSVG extends JsMessage {
|
||||
readonly svgString!: string;
|
||||
}
|
||||
|
||||
export class UpdateVisibleNodes extends JsMessage {
|
||||
readonly nodes!: bigint[];
|
||||
}
|
||||
|
||||
export class UpdateNodeGraphTransform extends JsMessage {
|
||||
readonly transform!: NodeGraphTransform;
|
||||
}
|
||||
@@ -1762,9 +1741,9 @@ export const messageMakers: Record<string, MessageMaker> = {
|
||||
UpdateMenuBarLayout,
|
||||
UpdateMouseCursor,
|
||||
UpdateNodeGraphControlBarLayout,
|
||||
UpdateNodeGraphRender,
|
||||
UpdateNodeGraphSelectionBox,
|
||||
UpdateNativeNodeGraphSVG,
|
||||
UpdateNodeGraphTransform,
|
||||
UpdateNodeGraphSelectionBox,
|
||||
UpdateNodeThumbnail,
|
||||
UpdateOpenDocumentsList,
|
||||
UpdatePlatform,
|
||||
@@ -1776,7 +1755,6 @@ export const messageMakers: Record<string, MessageMaker> = {
|
||||
UpdateToolOptionsLayout,
|
||||
UpdateToolShelfLayout,
|
||||
UpdateViewportHolePunch,
|
||||
UpdateVisibleNodes,
|
||||
UpdateWirePathInProgress,
|
||||
UpdateWorkingColorsLayout,
|
||||
} as const;
|
||||
|
||||
@@ -15,14 +15,11 @@ import {
|
||||
UpdateExportReorderIndex,
|
||||
UpdateImportsExports,
|
||||
UpdateLayerWidths,
|
||||
UpdateNodeGraphSvelteRender,
|
||||
UpdateShouldRenderSvelteNodes,
|
||||
UpdateNativeNodeGraphSVG,
|
||||
UpdateVisibleNodes,
|
||||
UpdateNodeGraphTransform,
|
||||
UpdateNodeThumbnail,
|
||||
UpdateWirePathInProgress,
|
||||
UpdateNodeGraphSelectionBox,
|
||||
UpdateNodeGraphTransform,
|
||||
} from "@graphite/messages";
|
||||
|
||||
export function createNodeGraphState(editor: Editor) {
|
||||
@@ -46,11 +43,6 @@ export function createNodeGraphState(editor: Editor) {
|
||||
inSelectedNetwork: true,
|
||||
previewedNode: undefined as bigint | undefined,
|
||||
|
||||
// TODO: Remove these fields
|
||||
visibleNodes: new Set<bigint>(),
|
||||
layerWidths: new Map<bigint, number>(),
|
||||
shouldRenderSvelteNodes: false,
|
||||
|
||||
// Data that will be passed in the context
|
||||
thumbnails: new Map<bigint, string>(),
|
||||
transform: { scale: 1, x: 0, y: 0 },
|
||||
@@ -107,42 +99,12 @@ export function createNodeGraphState(editor: Editor) {
|
||||
});
|
||||
});
|
||||
|
||||
editor.subscriptions.subscribeJsMessage(UpdateLayerWidths, (updateLayerWidths) => {
|
||||
update((state) => {
|
||||
state.layerWidths = updateLayerWidths.layerWidths;
|
||||
return state;
|
||||
});
|
||||
});
|
||||
editor.subscriptions.subscribeJsMessage(UpdateNodeGraphSvelteRender, (updateNodeGraphSvelteRender) => {
|
||||
update((state) => {
|
||||
state.nodesToRender.clear();
|
||||
updateNodeGraphSvelteRender.nodesToRender.forEach((node) => {
|
||||
state.nodesToRender.set(node.metadata.nodeId, node);
|
||||
});
|
||||
state.opacity = updateNodeGraphSvelteRender.opacity;
|
||||
state.inSelectedNetwork = updateNodeGraphSvelteRender.inSelectedNetwork;
|
||||
state.previewedNode = updateNodeGraphSvelteRender.previewedNode;
|
||||
return state;
|
||||
});
|
||||
});
|
||||
editor.subscriptions.subscribeJsMessage(UpdateShouldRenderSvelteNodes, (UpdateShouldRenderSvelteNodes) => {
|
||||
update((state) => {
|
||||
state.shouldRenderSvelteNodes = UpdateShouldRenderSvelteNodes.shouldRenderSvelteNodes;
|
||||
return state;
|
||||
});
|
||||
});
|
||||
editor.subscriptions.subscribeJsMessage(UpdateNativeNodeGraphSVG, (updateNativeNodeGraphRender) => {
|
||||
update((state) => {
|
||||
state.nativeNodeGraphSVGString = updateNativeNodeGraphRender.svgString;
|
||||
return state;
|
||||
});
|
||||
});
|
||||
editor.subscriptions.subscribeJsMessage(UpdateVisibleNodes, (updateVisibleNodes) => {
|
||||
update((state) => {
|
||||
state.visibleNodes = new Set<bigint>(updateVisibleNodes.nodes);
|
||||
return state;
|
||||
});
|
||||
});
|
||||
editor.subscriptions.subscribeJsMessage(UpdateNodeGraphTransform, (updateNodeGraphTransform) => {
|
||||
update((state) => {
|
||||
state.transform = updateNodeGraphTransform.transform;
|
||||
@@ -155,12 +117,6 @@ export function createNodeGraphState(editor: Editor) {
|
||||
return state;
|
||||
});
|
||||
});
|
||||
editor.subscriptions.subscribeJsMessage(UpdateWirePathInProgress, (updateWirePathInProgress) => {
|
||||
update((state) => {
|
||||
state.wirePathInProgress = updateWirePathInProgress.wirePathInProgress;
|
||||
return state;
|
||||
});
|
||||
});
|
||||
|
||||
return {
|
||||
subscribe,
|
||||
|
||||
@@ -785,13 +785,6 @@ impl EditorHandle {
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
/// Snaps the import/export edges to a grid space when the scroll bar is released
|
||||
#[wasm_bindgen(js_name = setGridAlignedEdges)]
|
||||
pub fn set_grid_aligned_edges(&self) {
|
||||
let message = NodeGraphMessage::SetGridAlignedEdges;
|
||||
self.dispatch(message);
|
||||
}
|
||||
|
||||
/// Merge the selected nodes into a subnetwork
|
||||
#[wasm_bindgen(js_name = mergeSelectedNodes)]
|
||||
pub fn merge_nodes(&self) {
|
||||
|
||||
Reference in New Issue
Block a user