fix point markers ui bug (#5684)

This commit is contained in:
skier233 2025-02-25 17:18:53 -05:00 committed by GitHub
parent b8af147a8d
commit f65976cf4d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 10 deletions

View file

@ -733,16 +733,8 @@ export const ScenePlayer: React.FC<IScenePlayerProps> = ({
}
}
// Add markers in chunks
const CHUNK_SIZE = 10;
for (let i = 0; i < timestampMarkers.length; i += CHUNK_SIZE) {
const chunk = timestampMarkers.slice(i, i + CHUNK_SIZE);
requestAnimationFrame(() => {
chunk.forEach((m) => markers.addDotMarker(m));
});
}
requestAnimationFrame(() => {
markers.addDotMarkers(timestampMarkers);
markers.addRangeMarkers(rangeMarkers);
});
}, [getPlayer, scene, uiConfig]);

View file

@ -100,6 +100,12 @@ class MarkersPlugin extends videojs.getPlugin("plugin") {
if (seekBar) {
seekBar.appendChild(markerSet.dot);
}
this.markers.push(marker);
this.markerDivs.push(markerSet);
}
addDotMarkers(markers: IMarker[]) {
markers.forEach(this.addDotMarker, this);
}
private renderRangeMarkers(markers: IMarker[], layer: number) {
@ -255,7 +261,16 @@ class MarkersPlugin extends videojs.getPlugin("plugin") {
}
clearMarkers() {
this.removeMarkers([...this.markers]);
for (const markerSet of this.markerDivs) {
if (markerSet.dot?.hasAttribute("marker-tooltip-shown")) {
this.hideMarkerTooltip();
}
markerSet.dot?.remove();
if (markerSet.range) markerSet.range.remove();
}
this.markers = [];
this.markerDivs = [];
}
// Implementing the findColors method