Skip to content

Commit

Permalink
[54109] Small code changes
Browse files Browse the repository at this point in the history
  • Loading branch information
apfohl committed Oct 21, 2024
1 parent fa70157 commit ffb6f89
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions frontend/src/app/shared/components/modal/modal.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class OpModalService {

constructor(
private readonly injector:Injector,
private readonly rendererFactory:RendererFactory2,
readonly rendererFactory:RendererFactory2,
) {
// Listen to keystrokes on window to close context menus
window.addEventListener('keydown', (evt:KeyboardEvent) => {
Expand Down Expand Up @@ -127,23 +127,16 @@ export class OpModalService {
}

private fixElementPosition(element:HTMLElement|null):void {
let anchor = document.body;

if (element !== null) {
anchor = element;
}
const anchor = element || document.body;

const scrollY:string = document.documentElement.style.getPropertyValue('--scroll-y');

this.bodyRenderer.setStyle(anchor, 'position', 'fixed');
this.bodyRenderer.setStyle(anchor, 'top', `-${scrollY}`);
}

private unfixElementPosition(element:HTMLElement|null):void {
let anchor = document.body;

if (element !== null) {
anchor = element;
}
const anchor = element || document.body;

const scrollY:string = anchor.style.top;

Expand Down

0 comments on commit ffb6f89

Please sign in to comment.