in src/visual/VisualStep.js [50:97]
update() {
const step = this.step;
const inNames = Object.keys(step.i);
const outNames = Object.keys(step.o);
const size = this.attributes.size;
const height = Math.max(cMinHeight, cHeightPerPort * Math.max(inNames.length, outNames.length), size.height);
const label = this._getLabel();
const width = Math.max(cDefaultWidth, label.length * cPixelPerSymbol + 2 * cLabelMargin, size.width);
this.set({
inPorts: inNames,
outPorts: outNames,
size: {
height,
width,
},
});
this.attr('.label', {
text: label,
});
const iPortsOn = this._updatePortsState(this.iPortsOn, step.i);
const oPortsOn = this._updatePortsState(this.oPortsOn, step.o);
this.iPortsOn = iPortsOn;
this.oPortsOn = oPortsOn;
const ports = this.getPorts();
_.forEach(ports, (port) => {
const stepPort = port.group === 'in' ? step.i[port.id] : step.o[port.id];
const isEmpty = (_.size(stepPort.inputs) + _.size(stepPort.outputs)) === 0;
const isOn = port.group === 'in' ? iPortsOn[port.id] : oPortsOn[port.id];
let newVal = 'port-body';
if (isEmpty) {
newVal += ' empty';
}
if (!isOn) {
newVal += ' disabled';
}
const propVal = this.portProp(port.id, 'attrs/circle/class');
if (!propVal || newVal !== propVal) {
this.portProp(port.id, 'attrs/circle/class', newVal);
}
});
}