Skip to content

Commit 81188e7

Browse files
RajeshwriKrajeshwari-kiwadjharajeev55
authored
Task/Plot and Input controls motion fix (#35)
Two changes are being addressed here: 1. Plots were not moving to visible screen when active or highlighted 2. Input container was always aligning to center and hiding some controls when used in a single column mode --------- Co-authored-by: rajeshwari-kiwad <rajeshwari.kiwad@tektronix.com> Co-authored-by: jharajeev55 <jharajeev55@gmail.com>
1 parent 0ae230b commit 81188e7

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

script-gen-ui/src/app/components/main-sweep/main-sweep.component.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ <h3>Bias</h3>
100100
<div *ngIf="isBiasExpanded">
101101
<div *ngFor="let biasChannel of biasChannels; let i = index">
102102
<app-bias
103-
(focus)="setActiveComponent('bias', i)"
104-
(blur)="clearActiveComponent()"
105103
(emitBiasChannelData)="updateBiasChannelsConfig($event)"
106104
(emitBiasExpanderState)="
107105
handleChannelExpanderStateChange($event.uuid, $event.isExpanded)

script-gen-ui/src/app/components/main-sweep/main-sweep.component.ts

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export class MainSweepComponent implements OnChanges {
7272

7373
activeComponent: 'bias' | 'step' | 'sweep' | null = null; // Tracks the active component
7474
activeIndex: number | null = null;
75+
isScrolled = false;
7576

7677
colorIndex = 0;
7778
colors: string[] = [
@@ -89,16 +90,22 @@ export class MainSweepComponent implements OnChanges {
8990
component: 'bias' | 'step' | 'sweep',
9091
index: number
9192
): void {
93+
// Reset scroll flag when switching to a different component
94+
if (this.activeComponent !== component || this.activeIndex !== index) {
95+
this.isScrolled = false;
96+
}
97+
9298
this.activeComponent = component;
9399
this.activeIndex = index;
94100
console.log(`Active Component: ${component}, Index: ${index}`);
95101
}
96102

97103
// Called when an input box loses focus
98-
clearActiveComponent(): void {
99-
this.activeComponent = null;
100-
this.activeIndex = null;
101-
}
104+
// clearActiveComponent(): void {
105+
// this.activeComponent = null;
106+
// this.activeIndex = null;
107+
// this.isScrolled = false; // Reset scroll flag when clearing active component
108+
// }
102109

103110
showPopupBox = false;
104111
showTiming = false;
@@ -144,6 +151,13 @@ export class MainSweepComponent implements OnChanges {
144151
// Handle the change in sweepConfig here if needed
145152
this.updateAll();
146153
console.log('sweepConfig updated:', this.sweepConfig);
154+
155+
// Re-scroll to active plot after data updates if there's an active component
156+
if (this.activeComponent !== null && this.activeIndex !== null) {
157+
setTimeout(() => {
158+
this.scrollToPlotInPlotContainer(this.activeComponent!, this.activeIndex!);
159+
}, 10);
160+
}
147161
}
148162
}
149163

@@ -171,6 +185,11 @@ export class MainSweepComponent implements OnChanges {
171185
componentType: 'bias' | 'step' | 'sweep',
172186
index: number
173187
): void {
188+
// Skip scrolling if this is already the active component (clicked again)
189+
if (this.isScrolled === true) {
190+
return;
191+
}
192+
174193
let component: BiasComponent | StepComponent | SweepComponent | undefined;
175194

176195
if (componentType === 'bias') {
@@ -188,14 +207,18 @@ export class MainSweepComponent implements OnChanges {
188207
block: 'center', // Align to the center of the viewport
189208
});
190209
}
210+
this.isScrolled = true;
191211
}
192212

193213
scrollToPlotInPlotContainer(
194214
componentType: 'bias' | 'step' | 'sweep',
195215
index: number
196216
): void {
197217
if (this.plotContainer) {
198-
this.plotContainer.scrollToPlot(componentType, index);
218+
// Use setTimeout to ensure scroll happens after any pending view updates
219+
setTimeout(() => {
220+
this.plotContainer.scrollToPlot(componentType, index);
221+
}, 100);
199222
}
200223
}
201224

0 commit comments

Comments
 (0)