fix(editor): Properly set colors for connections and labels on nodes with pinned data (#8209)
Co-authored-by: Alex Grozav <alex@grozav.com>
This commit is contained in:
@@ -755,9 +755,15 @@ export const getRunItemsLabel = (output: { total: number; iterations: number }):
|
||||
|
||||
export const addConnectionOutputSuccess = (
|
||||
connection: Connection,
|
||||
output: { total: number; iterations: number },
|
||||
output: { total: number; iterations: number; classNames?: string[] },
|
||||
) => {
|
||||
connection.addClass('success');
|
||||
const classNames: string[] = ['success'];
|
||||
|
||||
if (output.classNames) {
|
||||
classNames.push(...output.classNames);
|
||||
}
|
||||
|
||||
connection.addClass(classNames.join(' '));
|
||||
if (getOverlay(connection, OVERLAY_RUN_ITEMS_ID)) {
|
||||
connection.removeOverlay(OVERLAY_RUN_ITEMS_ID);
|
||||
}
|
||||
@@ -771,7 +777,7 @@ export const addConnectionOutputSuccess = (
|
||||
const container = document.createElement('div');
|
||||
const span = document.createElement('span');
|
||||
|
||||
container.classList.add('connection-run-items-label');
|
||||
container.classList.add(...['connection-run-items-label', ...classNames]);
|
||||
span.classList.add('floating');
|
||||
span.innerHTML = getRunItemsLabel(output);
|
||||
container.appendChild(span);
|
||||
@@ -791,6 +797,27 @@ export const addConnectionOutputSuccess = (
|
||||
});
|
||||
};
|
||||
|
||||
export const addClassesToOverlays = ({
|
||||
connection,
|
||||
overlayIds,
|
||||
classNames,
|
||||
includeConnector,
|
||||
}: {
|
||||
connection: Connection;
|
||||
overlayIds: string[];
|
||||
classNames: string[];
|
||||
includeConnector?: boolean;
|
||||
}) => {
|
||||
overlayIds.forEach((overlayId) => {
|
||||
const overlay = getOverlay(connection, overlayId);
|
||||
|
||||
overlay?.canvas?.classList.add(...classNames);
|
||||
if (includeConnector) {
|
||||
connection.connector.canvas?.classList.add(...classNames);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const getContentDimensions = (): { editorWidth: number; editorHeight: number } => {
|
||||
let contentWidth = window.innerWidth;
|
||||
let contentHeight = window.innerHeight;
|
||||
|
||||
Reference in New Issue
Block a user