Skip to content

[2e] Replace hardcoded _setup(893, 1117) with ARFset constructor options #24

@kalwalt

Description

@kalwalt

Summary

Replace hardcoded _setup(893, 1117) magic numbers with configurable ARFset constructor options

Environment

  • Product/Service: FeatureSET-Display — JavaScript API
  • File: src/ARFset.js:249-251

Problem Description

The ARFset constructor calls _setup(893, 1117) with hardcoded canvas dimensions. These magic numbers are undocumented, cannot be overridden by callers, and do not reflect real use-case canvas sizes. Any application needing a different canvas size must patch the source.

Expected Behavior

The ARFset constructor accepts an optional { width, height } options object with sensible defaults (e.g. { width: 893, height: 1117 } to maintain existing behavior). Callers can override dimensions without modifying the library.

Actual Behavior

Canvas dimensions are hardcoded in the constructor; no way for callers to specify a different size.

Tasks

  • Accept { width, height } in the ARFset constructor with defaults matching current hardcoded values
  • Pass the options through to _setup(width, height)
  • Update example HTML files (example/example.html, example_es6.html) to explicitly pass dimensions or rely on defaults

Impact

Low — Usability improvement; no functional regression. Current defaults preserve existing behavior.

Additional Context

This is a non-breaking change if defaults match current hardcoded values (893 × 1117). Consider also accepting a single canvas element reference as an alternative constructor signature to read dimensions from the DOM element directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions