Skip to content

Commit 065342d

Browse files
committed
Remove unused function
1 parent e14cc2b commit 065342d

File tree

6 files changed

+12
-63
lines changed

6 files changed

+12
-63
lines changed

src/vs/workbench/contrib/positronPlots/browser/components/dynamicPlotInstance.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { ZoomLevel } from '../../../../services/positronPlots/common/positronPlo
2525
interface DynamicPlotInstanceProps {
2626
width: number;
2727
height: number;
28-
zoom?: ZoomLevel;
28+
zoom: ZoomLevel;
2929
plotClient: PlotClientInstance;
3030
}
3131

src/vs/workbench/contrib/positronPlots/browser/components/panZoomImage.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interface PanZoomImageProps {
1515
height: number;
1616
imageUri: string;
1717
description: string;
18-
zoom?: ZoomLevel;
18+
zoom: ZoomLevel;
1919
}
2020

2121
/**
@@ -37,13 +37,12 @@ export const PanZoomImage = (props: PanZoomImageProps) => {
3737
if (!imageRef.current) {
3838
return;
3939
}
40-
const zoomLevel = props.zoom ?? ZoomLevel.Fit;
4140
// scale by the zoom level
4241
// if the zoom level is Fill, then the image should fill the container using css
43-
const adjustedWidth = props.zoom === ZoomLevel.Fit ? naturalWidth : naturalWidth * zoomLevel;
44-
const adjustedHeight = props.zoom === ZoomLevel.Fit ? naturalHeight : naturalHeight * zoomLevel;
42+
const adjustedWidth = props.zoom === ZoomLevel.Fit ? naturalWidth : naturalWidth * props.zoom;
43+
const adjustedHeight = props.zoom === ZoomLevel.Fit ? naturalHeight : naturalHeight * props.zoom;
4544

46-
if (zoomLevel === ZoomLevel.Fit) {
45+
if (props.zoom === ZoomLevel.Fit) {
4746
imageRef.current.style.width = '100%';
4847
imageRef.current.style.height = '100%';
4948
imageRef.current.style.objectFit = 'contain';

src/vs/workbench/contrib/positronPlots/browser/positronPlotsService.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -564,17 +564,6 @@ export class PositronPlotsService extends Disposable implements IPositronPlotsSe
564564
}
565565
}
566566

567-
getEditorPlotZoom(plotId: string): ZoomLevel | undefined {
568-
const plot = this._editorPlots.get(plotId);
569-
if (plot instanceof PlotClientInstance) {
570-
// Return the zoom level for the plot, or the default zoom level if not set
571-
return plot.metadata.zoom_level;
572-
} else {
573-
this._notificationService.error(localize('positronPlots.zoom.getInvalidPlotType', 'Cannot get zoom for this plot type'));
574-
return undefined;
575-
}
576-
}
577-
578567
/**
579568
* Sets a custom plot size and applies it as a custom sizing policy.
580569
*

src/vs/workbench/contrib/positronPlotsEditor/browser/editorPlotsContainer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ interface EditorPlotsContainerProps {
2626

2727
export const EditorPlotsContainer = (props: EditorPlotsContainerProps) => {
2828

29-
const [zoom, setZoom] = useState<ZoomLevel>(props.plotClient instanceof PlotClientInstance ? props.plotClient.zoomLevel : ZoomLevel.Fit);
29+
const [zoom, setZoom] = useState<ZoomLevel>(ZoomLevel.Fit);
3030
const [darkFilterMode, setDarkFilterMode] = useState(props.positronPlotsService.darkFilterMode);
3131

3232
const render = () => {
@@ -79,7 +79,7 @@ export const EditorPlotsContainer = (props: EditorPlotsContainerProps) => {
7979
}, [props.plotClient]);
8080

8181
return (
82-
<div className={`dark-filter-${darkFilterMode}`} style={
82+
<div className={'dark-filter-' + darkFilterMode} style={
8383
{
8484
width: props.width,
8585
height: props.height

src/vs/workbench/services/positronPlots/test/common/testPlotsServiceHelper.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import { TestPositronPlotsService } from './testPositronPlotsService.js';
77
import { TestPositronPlotClient } from './testPositronPlotClient.js';
8-
import { HistoryPolicy } from '../../common/positronPlots.js';
8+
import { HistoryPolicy, ZoomLevel } from '../../common/positronPlots.js';
99

1010
/**
1111
* Example of how to use the TestPositronPlotsService in tests.
@@ -21,7 +21,7 @@ export function createTestPlotsServiceWithPlots(): TestPositronPlotsService {
2121
created: Date.now(),
2222
parent_id: '',
2323
code: 'plot(1:10)',
24-
zoom_level: 0,
24+
zoom_level: ZoomLevel.Fit,
2525
});
2626

2727
const plotClient2 = new TestPositronPlotClient({
@@ -30,7 +30,7 @@ export function createTestPlotsServiceWithPlots(): TestPositronPlotsService {
3030
created: Date.now() + 1000, // Created later
3131
parent_id: '',
3232
code: 'hist(rnorm(100))',
33-
zoom_level: 0,
33+
zoom_level: ZoomLevel.Fit,
3434
});
3535

3636
// Add the plot clients to the service

src/vs/workbench/services/positronPlots/test/common/testPositronPlotsService.ts

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
import { Emitter } from '../../../../../base/common/event.js';
77
import { Disposable, DisposableMap } from '../../../../../base/common/lifecycle.js';
8-
import { IPositronPlotsService, IPositronPlotClient, HistoryPolicy, DarkFilter, PlotRenderSettings, ZoomLevel } from '../../common/positronPlots.js';
8+
import { IPositronPlotsService, IPositronPlotClient, HistoryPolicy, DarkFilter, PlotRenderSettings } from '../../common/positronPlots.js';
99
import { IPositronPlotSizingPolicy } from '../../common/sizingPolicy.js';
10-
import { IPositronPlotMetadata, PlotClientLocation } from '../../../languageRuntime/common/languageRuntimePlotClient.js';
10+
import { IPositronPlotMetadata } from '../../../languageRuntime/common/languageRuntimePlotClient.js';
1111

1212
/**
1313
* TestPositronPlotsService class.
@@ -28,9 +28,6 @@ export class TestPositronPlotsService extends Disposable implements IPositronPlo
2828
*/
2929
private readonly _editorPlots = new Map<string, IPositronPlotClient>();
3030

31-
/** Map of zoom levels for editor plots, keyed by plot ID. */
32-
private readonly _editorPlotZoomLevels = new Map<string, number>();
33-
3431
/**
3532
* Gets or sets the ID of the currently selected plot.
3633
*/
@@ -102,10 +99,6 @@ export class TestPositronPlotsService extends Disposable implements IPositronPlo
10299
private readonly _onDidChangeSizingPolicyEmitter =
103100
this._register(new Emitter<IPositronPlotSizingPolicy>());
104101

105-
/** The emitter for the _plotZoomEmitter event */
106-
private readonly _onDidChangePlotZoomEmitter =
107-
this._register(new Emitter<{ plotId: string; zoomLevel: number; location: PlotClientLocation }>());
108-
109102
//#endregion Private Properties
110103

111104
//#region Constructor
@@ -215,11 +208,6 @@ export class TestPositronPlotsService extends Disposable implements IPositronPlo
215208
*/
216209
readonly onDidChangeSizingPolicy = this._onDidChangeSizingPolicyEmitter.event;
217210

218-
/**
219-
* The onDidChangePlotZoom event.
220-
*/
221-
readonly onDidChangePlotZoom = this._onDidChangePlotZoomEmitter.event;
222-
223211
/**
224212
* Gets the cached plot thumbnail URI for a given plot ID.
225213
* @param plotId The plot ID to get the thumbnail URI for.
@@ -474,33 +462,6 @@ export class TestPositronPlotsService extends Disposable implements IPositronPlo
474462
plotClient.dispose();
475463
}
476464

477-
/**
478-
* Sets the zoom level for the editor plot with the given ID.
479-
* @param plotId The ID of the plot to set the zoom level for.
480-
* @param zoomLevel The zoom level to set for the plot.
481-
*/
482-
setEditorPlotZoom(plotId: string, zoomLevel: number): void {
483-
if (this._editorPlots.has(plotId)) {
484-
this._editorPlotZoomLevels.set(plotId, zoomLevel);
485-
} else {
486-
throw new Error(`Plot with ID ${plotId} does not exist.`);
487-
}
488-
}
489-
490-
/**
491-
* Gets the zoom level for the editor plot with the given ID.
492-
* @param plotId The ID of the plot to get the zoom level for.
493-
* @returns The zoom level for the plot, or undefined if not found.
494-
*/
495-
getEditorPlotZoomLevel(plotId: string): number | undefined {
496-
const plotClient = this._editorPlots.get(plotId);
497-
if (plotClient) {
498-
return this._editorPlotZoomLevels.get(plotId) ?? ZoomLevel.Fit;
499-
}
500-
501-
return ZoomLevel.Fit; // Default to Fit for test implementation
502-
}
503-
504465
/**
505466
* Placeholder for service initialization.
506467
*/

0 commit comments

Comments
 (0)