Improve plus endpoint string rendering

This commit is contained in:
Iván Ovejero 2021-12-06 12:19:07 +01:00
parent bd9c822a58
commit 7a64a05088
2 changed files with 6 additions and 8 deletions

View file

@ -181,6 +181,7 @@ export const nodeBase = mixins(
hover: false, hover: false,
showOutputLabel: nodeTypeData.outputs.length === 1, showOutputLabel: nodeTypeData.outputs.length === 1,
size: nodeTypeData.outputs.length >= 3 ? 'small' : 'medium', size: nodeTypeData.outputs.length >= 3 ? 'small' : 'medium',
hoverMessage: this.$baseText('nodesBase.clickToAddNodeOrDragToConnect'),
}, },
endpointHoverStyle: { endpointHoverStyle: {
fill: getStyleTokenValue('--color-primary'), fill: getStyleTokenValue('--color-primary'),
@ -204,14 +205,6 @@ export const nodeBase = mixins(
index: i, index: i,
totalEndpoints: nodeTypeData.outputs.length, totalEndpoints: nodeTypeData.outputs.length,
}; };
const _plusEndpoint = this.instance.getEndpoint(
CanvasHelpers.getOutputEndpointUUID(this.nodeIndex, index),
);
const dropHoverMessageDiv = _plusEndpoint.canvas.children[1].children[1];
dropHoverMessageDiv.innerHTML = this.$baseText('nodesBase.clickToAddNodeOrDragToConnect');
} }
}); });
}, },

View file

@ -461,6 +461,11 @@
this.size = endpointStyle.size || this.size; this.size = endpointStyle.size || this.size;
this.showOutputLabel = !!endpointStyle.showOutputLabel; this.showOutputLabel = !!endpointStyle.showOutputLabel;
if (this.hoverMessage !== endpointStyle.hoverMessage) {
this.hoverMessage = endpointStyle.hoverMessage;
message.innerHTML = endpointStyle.hoverMessage;
}
if (this.size !== 'medium') { if (this.size !== 'medium') {
container.classList.add(this.size); container.classList.add(this.size);
} }