fix layout issue

This commit is contained in:
meganrogge 2023-06-19 14:11:06 -04:00
parent 2c9da742fa
commit fa35e8dee8
No known key found for this signature in database
GPG key ID: AA74638D4878183D

View file

@ -24,8 +24,8 @@ import { getSimpleEditorOptions } from 'vs/workbench/contrib/codeEditor/browser/
import { IDisposable } from 'xterm';
const enum DIMENSION_DEFAULT {
WIDTH = .4,
HEIGHT = .2
WIDTH = .6,
HEIGHT = 200
}
export interface IAccessibleContentProvider {
@ -125,7 +125,6 @@ class AccessibleView extends Disposable {
model.setLanguage(provider.options.language);
}
container.appendChild(this._editorContainer);
this._layout();
this._register(this._editorWidget.onKeyUp((e) => {
if (e.keyCode === KeyCode.Escape) {
this._contextViewService.hideContextView();
@ -149,13 +148,8 @@ class AccessibleView extends Disposable {
private _layout(): void {
const windowWidth = window.innerWidth;
const windowHeight = window.innerHeight;
const width = windowWidth * DIMENSION_DEFAULT.WIDTH;
const height = Math.min(windowHeight * DIMENSION_DEFAULT.HEIGHT, this._editorWidget.getContentHeight());
this._editorWidget.layout({ width, height });
const top = Math.round((windowHeight - height) / 2);
this._editorContainer.style.top = `${top}px`;
this._editorWidget.layout({ width, height: this._editorWidget.getContentHeight() });
const left = Math.round((windowWidth - width) / 2);
this._editorContainer.style.left = `${left}px`;
}