Skip to content

Best practices for providing track height #2002

@rmhubley

Description

@rmhubley

I have run into an issue while designing a track that uses autoHeight. I have implemented a packing function that, in addition to the features, depends on having the bpPerPixel and graphics context (for calculating text measurements). I assumed that I would simply call my packing routine from implementations of getFeatures() or computeTrackHeight(), however neither of these function signatures provide the graphic context, and computeTrackHeight() doesn't provide bpPerPixel. I was forced to use the standard computeTrackHeight (MAX(row)+1), and place my packing call in draw(). The side-effect being, in the initial load of the browser computeTrackHeight() is called before draw() and the track height is calculated from un-initialized row assignments.

I wonder if there is preferred design for tracks that need to perform a height calculation based on scale and text measurements?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions