Skip to content

Commit 5ec2fd1

Browse files
committed
fix: edit label UI does not resize on graph zoom
Fixes GH-1601 - ensure that the edit label UI is properly resizing if the graph is zoomed in or out Contributed on behalf of STMicroelectronics
1 parent 2fe0c5e commit 5ec2fd1

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

packages/client/src/features/label-edit-ui/label-edit-ui-module.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@
1313
*
1414
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
1515
********************************************************************************/
16-
import { EditLabelAction, EditLabelActionHandler, FeatureModule, TYPES, configureActionHandler } from '@eclipse-glsp/sprotty';
16+
import {
17+
EditLabelAction,
18+
EditLabelActionHandler,
19+
FeatureModule,
20+
SetViewportAction,
21+
TYPES,
22+
configureActionHandler
23+
} from '@eclipse-glsp/sprotty';
1724
import { GlspEditLabelUI } from './label-edit-ui';
1825

1926
export const labelEditUiModule = new FeatureModule(
@@ -22,6 +29,7 @@ export const labelEditUiModule = new FeatureModule(
2229
configureActionHandler(context, EditLabelAction.KIND, EditLabelActionHandler);
2330
bind(GlspEditLabelUI).toSelf().inSingletonScope();
2431
bind(TYPES.IUIExtension).toService(GlspEditLabelUI);
32+
configureActionHandler(context, SetViewportAction.KIND, GlspEditLabelUI);
2533
},
2634
{ featureId: Symbol('labelEditUi') }
2735
);

packages/client/src/features/label-edit-ui/label-edit-ui.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
*
1414
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
1515
********************************************************************************/
16-
import { EditLabelUI } from '@eclipse-glsp/sprotty';
16+
import { Action, EditLabelUI, IActionHandler, SetViewportAction } from '@eclipse-glsp/sprotty';
1717
import { injectable } from 'inversify';
1818
import { CSS_HIDDEN_EXTENSION_CLASS, CSS_UI_EXTENSION_CLASS } from '../../base/ui-extension/ui-extension';
1919

2020
@injectable()
21-
export class GlspEditLabelUI extends EditLabelUI {
21+
export class GlspEditLabelUI extends EditLabelUI implements IActionHandler {
2222
protected override initializeContents(containerElement: HTMLElement): void {
2323
super.initializeContents(containerElement);
2424
containerElement.classList.add(CSS_UI_EXTENSION_CLASS);
@@ -32,4 +32,11 @@ export class GlspEditLabelUI extends EditLabelUI {
3232
this.containerElement?.classList.add(CSS_HIDDEN_EXTENSION_CLASS);
3333
}
3434
}
35+
36+
handle(action: Action): void {
37+
if (SetViewportAction.is(action) && this.isActive && this.containerElement) {
38+
this.setPosition(this.containerElement);
39+
this.applyFontStyling();
40+
}
41+
}
3542
}

0 commit comments

Comments
 (0)