Skip to content

Commit

Permalink
Update heatmap when changing origin location
Browse files Browse the repository at this point in the history
  • Loading branch information
jwbonner committed Aug 29, 2023
1 parent b402846 commit 7429ec3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/shared/visualizers/OdometryVisualizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default class OdometryVisualizer implements Visualizer {
private heatmap: h337.Heatmap<"value", "x", "y"> | null = null;
private lastWidth = 0;
private lastHeight = 0;
private lastObjectsFlipped: boolean | null = null;
private lastHeatmapData = "";
private lastImageSource = "";

Expand Down Expand Up @@ -142,10 +143,16 @@ export default class OdometryVisualizer implements Visualizer {

// Recreate heatmap canvas
let newHeatmapInstance = false;
if (width !== this.lastWidth || height !== this.lastHeight || !this.heatmap) {
if (
width !== this.lastWidth ||
height !== this.lastHeight ||
objectsFlipped !== this.lastObjectsFlipped ||
!this.heatmap
) {
newHeatmapInstance = true;
this.lastWidth = width;
this.lastHeight = height;
this.lastObjectsFlipped = objectsFlipped;
while (this.HEATMAP_CONTAINER.firstChild) {
this.HEATMAP_CONTAINER.removeChild(this.HEATMAP_CONTAINER.firstChild);
}
Expand Down

0 comments on commit 7429ec3

Please sign in to comment.