Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions core/renderers/zelos/drawer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {Drawer as BaseDrawer} from '../common/drawer.js';
import {Connection} from '../measurables/connection.js';
import type {InlineInput} from '../measurables/inline_input.js';
import {OutputConnection} from '../measurables/output_connection.js';
import type {PreviousConnection} from '../measurables/previous_connection.js';
import type {Row} from '../measurables/row.js';
import type {SpacerRow} from '../measurables/spacer_row.js';
import {Types} from '../measurables/types.js';
Expand Down Expand Up @@ -86,6 +87,40 @@ export class Drawer extends BaseDrawer {
}
}

protected override drawTop_() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the changes are needed at the zelos level, I think they need to be one level up in the common/drawer

const topRow = this.info_.topRow;
const elements = topRow.elements;

this.positionPreviousConnection_();
this.outlinePath_ += svgPaths.moveBy(topRow.xPos, this.info_.startY);
for (let i = 0, elem; (elem = elements[i]); i++) {
if (Types.isLeftRoundedCorner(elem)) {
this.outlinePath_ += this.constants_.OUTSIDE_CORNERS.topLeft;
} else if (Types.isRightRoundedCorner(elem)) {
this.outlinePath_ += this.constants_.OUTSIDE_CORNERS.topRight;
} else if (
Types.isPreviousConnection(elem) &&
elem instanceof Connection
) {
this.outlinePath_ += (
(elem as PreviousConnection).shape as Notch
).pathLeft;
} else if (Types.isHat(elem)) {
this.outlinePath_ += this.constants_.START_HAT.path;
} else if (Types.isSpacer(elem)) {
this.outlinePath_ += svgPaths.lineOnAxis('h', elem.width);
}
}
// No branch for a square corner, because it's a no-op.
const hasHat = 'hasHat' in topRow && topRow.hasHat;
const nextConnection = this.info_.bottomRow.connection;
const isConnected = nextConnection?.connectionModel?.isConnected() ?? false;

if (!hasHat || isConnected) {
this.outlinePath_ += svgPaths.lineOnAxis('v', topRow.height);
}
}

/**
* Add steps for the right side of a row that does not have value or
* statement input connections.
Expand Down
Loading