Skip to content

Releases: interacta-io/css-labels

Release v0.6

02 Mar 10:13
cd640cc

Choose a tag to compare

Fixes & improvements

  • Less label flicker — When overlapping labels have equal weight and neither is forced to show, the collision resolver now favors the label that was already visible. This prevents labels from flickering between frames when competing labels have the same priority. CssLabel exposes getPrevVisible(); the collision logic uses it as the tie-breaker.

  • Cached bounding rect — Size and overlap use a cached getBoundingClientRect(), so multiline and rotated labels get the correct overlap box. Fixes #9 (multiline HTML) and #14 (rotated labels).

Release v0.5

18 Feb 08:56

Choose a tag to compare

New

  • Label rotation — Labels support an optional rotation (degrees). Use the rotation field in label options with LabelRenderer, or setRotation(degrees) with CssLabel. 0 = horizontal; positive = clockwise; rotation is around the label’s bottom-center.

Release v0.4

18 Feb 05:22
71bfddd

Choose a tag to compare

Bug fixes

  • Default font size and padding — Labels now always get the default font size and padding on the element, even when you don’t pass them or pass the same values as the defaults. Fixes #10
  • Labels with draw(false) — When you call draw(false) to skip overlap detection, labels are still shown. Visibility is set from whether they’re on screen before drawing. Fixes #7

Improvements

  • Label text — You can pass label text as a number; it’s converted to a string automatically.

Security

  • XSS prevention — Label text is set via textContent by default. Use dangerouslySetHtml() or the dangerousHtml option only for trusted or sanitized HTML.

Release v0.3

10 Feb 06:05
d69652f

Choose a tag to compare

What's New

Fixes & improvements

  • Empty/whitespace labels are now correctly treated as not visible in getVisibility.
  • Label overlap detection uses Sweep and Prune for better performance when many labels are on screen.

For developers

  • Storybook is available: run npm run storybook for docs and interactive demos.

Release v0.2

12 Aug 09:59
352aabb

Choose a tag to compare

What's New

Content Security Policy (CSP) Support

  • New dontInjectStyles option added to both CssLabel constructor and LabelRenderer options
  • Allows users to disable automatic CSS injection for CSP compliance
  • The CSS can be imported directly via @interacta/css-labels/styles.css
  • Use this option when your app has strict CSP rules that prevent dynamic style injection

Usage:

// Import CSS manually in your app
import '@interacta/css-labels/styles.css'

// Then disable auto-injection
const renderer = new LabelRenderer(canvas, { dontInjectStyles: true })

Individual Label Styling And Performance Improvements

  • Per-label customization: Set fontSize and padding for individual labels
  • Faster rendering: Optimized text measurements and reduced redundant calculations
  • Better label management: Improved performance for frequent updates