Skip to content

Commit

Permalink
fix: handle correclty the pixel indicator on zoom in UI
Browse files Browse the repository at this point in the history
  • Loading branch information
seankmartin committed Sep 27, 2024
1 parent 6c171df commit 9b4c306
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/ui/screenshot_menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export class ScreenshotDialog extends Overlay {
throttle(() => {
this.populateLayerResolutionTable();
this.handleScreenshotResize();
this.populatePanelResolutionTable();
}, 500),
);
constructor(private screenshotManager: ScreenshotManager) {
Expand Down
6 changes: 4 additions & 2 deletions src/util/screenshot_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ export class ScreenshotManager extends RefCounted {
screenshotStartTime = 0;
screenshotMode: ScreenshotMode = ScreenshotMode.OFF;
statisticsUpdated = new Signal<(state: ScreenshotLoadStatistics) => void>();
zoomMaybeChanged = new NullarySignal();
screenshotFinished = new NullarySignal();
zoomMaybeChanged = new NullarySignal();
private _shouldKeepSliceViewFOVFixed: boolean = true;
private _screenshotScale: number = 1;
private filename: string = "";
Expand Down Expand Up @@ -208,6 +208,7 @@ export class ScreenshotManager extends RefCounted {
public set screenshotScale(scale: number) {
this.handleScreenshotZoom(scale);
this._screenshotScale = scale;
this.zoomMaybeChanged.dispatch();
}

public get shouldKeepSliceViewFOVFixed() {
Expand All @@ -219,8 +220,10 @@ export class ScreenshotManager extends RefCounted {
this._shouldKeepSliceViewFOVFixed = enableFixedFOV;
if (!enableFixedFOV && wasInFixedFOVMode) {
this.handleScreenshotZoom(1 / this.screenshotScale, true /* resetZoom */);
this.zoomMaybeChanged.dispatch();
} else if (enableFixedFOV && !wasInFixedFOVMode) {
this.handleScreenshotZoom(this.screenshotScale, true /* resetZoom */);
this.zoomMaybeChanged.dispatch();
}
}

Expand Down Expand Up @@ -322,7 +325,6 @@ export class ScreenshotManager extends RefCounted {
break;
}
}
this.zoomMaybeChanged.dispatch();
}
}

Expand Down

0 comments on commit 9b4c306

Please sign in to comment.