Skip to content

Commit

Permalink
fix point markers ui bug (#5684)
Browse files Browse the repository at this point in the history
  • Loading branch information
skier233 authored Feb 25, 2025
1 parent b8af147 commit f65976c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
10 changes: 1 addition & 9 deletions ui/v2.5/src/components/ScenePlayer/ScenePlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
17 changes: 16 additions & 1 deletion ui/v2.5/src/components/ScenePlayer/markers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f65976c

Please sign in to comment.