Skip to content

Render related events should not fire on initial empty render #844

@Danielku15

Description

@Danielku15

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When alphaTab is initialized it performs internally a rendering of an empty music sheet. This empty rendering fires all the renderFinished and postRenderFinished events. This leads to issues like
CoderLine/alphaTabWebsite#33

Potentially also #810 is related.

Expected Behavior

The render events should not be fired for the empty initial render.

Steps To Reproduce

  1. Create a new AlphaTabApi
  2. Register for the postRenderFinished event afterwards
  3. Call afterwards the renderTracks function
  4. Notice the postRenderFinished being called once for the empty rendering, and then when actually the sheet was rendered.

Link to jsFiddle, CodePen, Project

No response

Found in Version

1.3-alpha

Platform

Web

Environment

- **OS**: Win11
- **Browser**: Chrome 94.0.4606.61

Anything else?

This issue was likely introduced in 1.3 when I fixed some issues that you could not clear the rendered score. Nowadays you can call the render functions with empty values to clear the rendered sheet. In such cases the events should still be fired.

But on the initialization this should not happen. Easiest way might be a flag which remembers whether there was really an initial render of a score requested and fire the render events only then.

Metadata

Metadata

Assignees

Labels

area-coreRelated to some core parts of alphaTabplatform-javascriptRelated to the JavaScript version of alphaTabstate-acceptedThis is a valid topic to work on.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions