-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Testing this track, it seems to work pretty well! I have run into a couple issues, which I'm documenting here in case they point to some issue.
In one test setup of my single-page web application, its viewconf has four tracks. The second track is a horizontal-multivec track and the fourth track is a horizontal-transcripts track, via the higlass-transcripts plugin.
Within the web application, I have the transcripts track object subscribe to the trackDimensionsModified event to get the new transcript track height whenever switching between "collapsed" and "all-transcripts-visible" modes:
setTimeout(() => {
const self = this;
const transcriptsTrackObj = this.mainHgView.api.getComponent().getTrackObject(
res.data.views[0].uid,
res.data.views[0].tracks.top[3].uid,
);
transcriptsTrackObj.pubSub.subscribe("trackDimensionsModified", (msg) => {
self.setState({
transcriptsTrackHeight: parseInt(transcriptsTrackObj.trackHeight), // <-- get transcript track height
}, () => {
self.updateViewportDimensions(); // <-- recalculate multivec track height
});
});
}, 500);
The updateViewportDimensions() generates a viewconf with correct dimensions for all tracks. But the multivec track has the wrong (old) height. It does not redraw itself with the correct (new) height, until I manually pan or zoom the parent HiGlass view.
As a workaround, in order to get the multivec track to redraw, I called scheduleRerender() on that track.
In this modified call, the chromatinStateTrackObj variable refers to the multivec track whose height needs to be adjusted:
setTimeout(() => {
const self = this;
const chromatinStateTrackObj = this.mainHgView.api.getComponent().getTrackObject(
res.data.views[0].uid,
res.data.views[0].tracks.top[1].uid,
);
const transcriptsTrackObj = this.mainHgView.api.getComponent().getTrackObject(
res.data.views[0].uid,
res.data.views[0].tracks.top[3].uid,
);
transcriptsTrackObj.pubSub.subscribe("trackDimensionsModified", (msg) => {
self.setState({
transcriptsTrackHeight: parseInt(transcriptsTrackObj.trackHeight), // <-- get transcript track height
}, () => {
self.updateViewportDimensions(); // <-- recalculate multivec track height
chromatinStateTrackObj.scheduleRerender(); // <-- redraw the multivec track
});
});
}, 500);
Using scheduleRerender() seems to "refresh" the multivec track, so that it renders with the height value specified in the parent viewconf.
I'm not sure if this is a bug, or if I am not using the plugin correctly. I can provide a link to the development site separately (via Slack etc.) if it is helpful to see the issue firsthand.