@@ -118,6 +118,9 @@ export class PositronPlotsService extends Disposable implements IPositronPlotsSe
118
118
/** The emitter for the onDidChangePlotsRenderSettings event */
119
119
private readonly _onDidChangePlotsRenderSettings = new Emitter < PlotRenderSettings > ( ) ;
120
120
121
+ /** The emitter for the _sizingPolicyEmitter event */
122
+ private readonly _onDidChangeSizingPolicyEmitter = new Emitter < IPositronPlotSizingPolicy > ;
123
+
121
124
/** The ID Of the currently selected plot, if any */
122
125
private _selectedPlotId : string | undefined ;
123
126
@@ -205,7 +208,7 @@ export class PositronPlotsService extends Disposable implements IPositronPlotsSe
205
208
this . _selectedPlotId = id ;
206
209
const selectedPlot = this . _plots . find ( ( plot ) => plot . id === id ) ;
207
210
if ( selectedPlot instanceof PlotClientInstance ) {
208
- this . _selectedSizingPolicy = selectedPlot . sizingPolicy ;
211
+ this . setSelectedSizingPolicy ( selectedPlot . sizingPolicy ) ;
209
212
}
210
213
} ) ) ;
211
214
@@ -440,7 +443,8 @@ export class PositronPlotsService extends Disposable implements IPositronPlotsSe
440
443
if ( ! policy ) {
441
444
throw new Error ( `Invalid sizing policy ID: ${ id } ` ) ;
442
445
}
443
- this . _selectedSizingPolicy = policy ;
446
+
447
+ this . setSelectedSizingPolicy ( policy ) ;
444
448
const selectedPlot = this . _plots . find ( ( plot ) => this . selectedPlotId === plot . id ) ;
445
449
if ( selectedPlot instanceof PlotClientInstance ) {
446
450
selectedPlot . sizingPolicy = policy ;
@@ -863,6 +867,7 @@ export class PositronPlotsService extends Disposable implements IPositronPlotsSe
863
867
onDidChangeHistoryPolicy : Event < HistoryPolicy > = this . _onDidChangeHistoryPolicy . event ;
864
868
onDidChangeDarkFilterMode : Event < DarkFilter > = this . _onDidChangeDarkFilterMode . event ;
865
869
onDidChangePlotsRenderSettings : Event < PlotRenderSettings > = this . _onDidChangePlotsRenderSettings . event ;
870
+ onDidChangeSizingPolicy : Event < IPositronPlotSizingPolicy > = this . _onDidChangeSizingPolicyEmitter . event ;
866
871
867
872
// Gets the individual plot instances.
868
873
get positronPlotInstances ( ) : IPositronPlotClient [ ] {
@@ -1353,6 +1358,11 @@ export class PositronPlotsService extends Disposable implements IPositronPlotsSe
1353
1358
*/
1354
1359
initialize ( ) {
1355
1360
}
1361
+
1362
+ private setSelectedSizingPolicy ( policy : IPositronPlotSizingPolicy ) {
1363
+ this . _selectedSizingPolicy = policy ;
1364
+ this . _onDidChangeSizingPolicyEmitter . fire ( policy ) ;
1365
+ }
1356
1366
}
1357
1367
1358
1368
function isActiveWebviewPlot ( plot : IPositronPlotClient ) : plot is WebviewPlotClient {
0 commit comments