Skip to content

Circuit Viz Improvements#2985

Open
ScottCarda-MS wants to merge 71 commits intomainfrom
sccarda/GeneralGroupGateType
Open

Circuit Viz Improvements#2985
ScottCarda-MS wants to merge 71 commits intomainfrom
sccarda/GeneralGroupGateType

Conversation

@ScottCarda-MS
Copy link
Contributor

@ScottCarda-MS ScottCarda-MS commented Feb 28, 2026

Some internal cleaning of the circuit visualization code:

  • removes ConditionalRender from circuits as that is for the now defunct classical conditional rendering.
  • removes GateType.ClassicalControlled as that was also for the defunct classical conditional rendering. This was replaced by merging conditional groups into GateType.Group rendering.
  • removes the data-attribute "zoom" and now treats GateType.Group as expandable/collapsible.
  • collapsed gate groups are now still treated as GateType.Group, just with their "expanded" data-attribute non-true.

This has the additional effect of allowing classically controlled groups to be expandable/collapsible, which makes for a more conceptually consistent pattern for users.

…control' into minestarks/rir-and-conditionals
@ScottCarda-MS ScottCarda-MS changed the title Sccarda/general group gate type Circuit Viz Improvements Feb 28, 2026
// Don't render classical wires for a group that is expanded - the wires
// will be coming out of the measurement operations *inside* the group.
continue;
const expanded = gate.dataAttributes?.["expanded"] === "true";
Copy link
Member

Choose a reason for hiding this comment

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

IIRC, when we get here, expanded is already supposed to be true so this is an unnecessary check. Not sure yet if your changes have changed this assumption.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yah it used to be the case that GateType.Group meants specifically an "expanded" group, but this is changed. GateType.Group is now any gate with children, and the dataAttribute determines if it is expanded or not. This is because collapsed groups need to be rendered with the expand/collapse button and possibly classical control circles.


const isCollapsedGroup =
renderData.type === GateType.Group &&
renderData.dataAttributes?.["expanded"] !== "true";
Copy link
Member

Choose a reason for hiding this comment

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

Can we get here? I thought GateType.Group implied expanded === "true" (again, I concluded this was the case before your changes, but you may have changed something, not sure yet)

Copy link
Member

Choose a reason for hiding this comment

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

My understanding was that if the group is collapsed, it just shows up as Gate.Unitary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This had to be changed, partly because we now have "collapsed" groups that have classical control circles, which are specific to groups, and partly because we dropped the data attribute "zoom" which used to tell us if a gate should have the expand/collapse button. Now it is just that GateType.Group gates have the expand/collapse button and optionally classical control circles.

@ScottCarda-MS ScottCarda-MS marked this pull request as ready for review March 6, 2026 19:51
@ScottCarda-MS ScottCarda-MS requested a review from billti as a code owner March 6, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants