diff --git a/src/cells/base.js b/src/cells/base.js index c593e42..e97b742 100644 --- a/src/cells/base.js +++ b/src/cells/base.js @@ -58,27 +58,27 @@ export const Gate = joint.shapes.basic.Generic.define('Gate', { _.set(args, ['attrs', 'path.wire.port_' + port.id], wire_args); _.set(args, ['attrs', 'circle.port_' + port.id], circle_args); let markup = ''; - if (port.bits > 1) { - markup += ''; - const bits_args = { - text: port.bits, - ref: 'circle.port_' + port.id - }; - if (vert) { - // TODO - } else { - bits_args['ref-y'] = -3; - bits_args['text-anchor'] = 'middle'; - } - if (side == 'left') { - bits_args['ref-dx'] = 6; - } else if (side == 'right') { - bits_args['ref-x'] = -6; - } else if (side == 'top') { - bits_args['ref-y'] = 6; - } else console.assert(false); - _.set(args, ['attrs', 'text.bits.port_' + port.id], bits_args); + + markup += ''; + const bits_args = { + text: port.bits > 1 ? port.bits : "", + ref: 'circle.port_' + port.id + }; + if (vert) { + // TODO + } else { + bits_args['ref-y'] = -3; + bits_args['text-anchor'] = 'middle'; } + if (side == 'left') { + bits_args['ref-dx'] = 6; + } else if (side == 'right') { + bits_args['ref-x'] = -6; + } else if (side == 'top') { + bits_args['ref-y'] = 6; + } else console.assert(false); + _.set(args, ['attrs', 'text.bits.port_' + port.id], bits_args); + const signame = port.dir == 'in' ? 'inputSignals' : 'outputSignals'; if (_.get(args, [signame, port.id]) === undefined) { _.set(args, [signame, port.id], Vector3vl.xes(port.bits));