Skip to content

Style library: polymers drawn as polymers again, and five smaller fixes - #21

Merged
adamjohnwright merged 2 commits into
mainfrom
fix/style-review-373
Oct 16, 2026
Merged

adamjohnwright merged 2 commits into
mainfrom
fix/style-review-373

Conversation

@adamjohnwright

Copy link
Copy Markdown
Contributor

These come from a review of WebsiteAngular's changes since its #373. The site now installs this library from here (dist/ngx-reactome-cytoscape-style), so these are what it draws with.

Fixed

Polymers. A polymer of a Protein, Molecule or RNA had no offset copy behind it. Their background layer is optional, because the node's own shape draws the body, and the polymer copy was skipped along with it. Every such polymer, including the legend's Polymer key, has been drawn as a plain entity since #373. The background is now copied whether it is optional or not, and is still drawn only once.

Cross and omitted-icon caches.

  • CROSS was cached on size alone and never cleared. Crossed-out nodes kept the light theme's red after a switch to dark, and two styles on one page shared whichever cross was drawn first.
  • OMMITED_ICON was cached on nothing at all.
  • Both are now keyed on what they draw with, and clearDrawersCache clears them.

Node drawing cache. A node's drawing was remembered by id, classes and selection only, so a node whose size or analysis values changed, without a cache clear, kept its old drawing. Size and analysis values are now part of the key.

interpolate. It read an exact 0 as "not in this segment" and fired a console assertion, and a curve of one point returned 0 instead of its value. The ends are now inclusive, and 0 counts as an answer.

Gradient cache. It was keyed on the node id, which the gradient never uses. Nodes with the same values now share one gradient.

Kept and documented

updateOn: 'position style' on the molecule layer costs one extra pass per rendered zoom frame. The cost is now explained where it is set; avoiding it would need every place that hides a node to report it.

Checked

Each behaviour change has a test that failed before it. The full suite passes (40 + 23 + 3), and the lint and dead-code baselines are lower (332 and 17).

🤖 Generated with Claude Code

Adam Wright and others added 2 commits October 16, 2026 13:26
From a review of WebsiteAngular's changes since its #373, the version of
this library the site now installs from here:
- A polymer of a Protein, Molecule or RNA had no offset copy behind it:
  their background layer is optional (the node's own shape draws the
  body), and the copy was skipped with it. Every such polymer, and the
  legend's Polymer key, was drawn as a plain entity since #373.
- CROSS was cached on size alone and never cleared, so crossed-out nodes
  kept the light theme's red after a switch to dark, and two styles on
  one page shared the first cross; OMMITED_ICON was cached on nothing.
  Both are keyed on what they draw with, and cleared with the drawers.
- The drawing a node gets was remembered by id, classes and selection --
  not size or analysis values -- so a node changed without a cache clear
  kept its old drawing. They are in the key.
- interpolate read an exact 0 as "not here" and asserted, and a curve of
  one point returned 0; ends are inclusive and 0 is an answer.
- The gradient cache was keyed on the node id it never uses; nodes with
  the same values share one.
- updateOn 'position style' costs one pass per rendered zoom frame on
  the molecule layer; kept, and the cost said where it is set.

Each behaviour change has a test that failed before it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Cytoscape paints every background layer over the node's own body, so the
polymer copy of an optional background (protein, molecule, RNA) was drawn
over the body -- shifted and darkened -- not behind it. Before
WebsiteAngular #373 the original was pushed again after the copies, which
is what made the copy read as behind; #373 dropped that with the
double-drawn decorators. The optional background goes in once more after
the copies; decorators still once. The test now checks that order, and
failed before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adamjohnwright
adamjohnwright merged commit fb07239 into main Oct 16, 2026
1 check passed
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.

1 participant