From e015c3d178fc923fb95490e69c2846f5cec79d89 Mon Sep 17 00:00:00 2001
From: jojohoch <joachim.hoch@iqb.hu-berlin.de>
Date: Fri, 18 Feb 2022 08:52:06 +0100
Subject: [PATCH] Fix positioning of floating marking bar when text element has
 fixed size

---
 docs/release-notes-player.txt                              | 3 ++-
 .../element-container/element-container.component.html     | 7 ++++---
 .../element-container/element-container.component.ts       | 6 +-----
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/docs/release-notes-player.txt b/docs/release-notes-player.txt
index db9012ad1..c311d6414 100644
--- a/docs/release-notes-player.txt
+++ b/docs/release-notes-player.txt
@@ -1,9 +1,10 @@
 Player
 ======
 1.20.0
-- Implement readonly fot text fields of cloze elements
+- Implement readonly for text fields of cloze elements
 - Fix height of elements with dynamic positioning and fixed size
 - Fix dimensions of image elements with dynamic positioning and fixed size
+- Fix positioning of floating virtual keyboard for fixed size elements
 - Fix positioning of floating marking bar when text element is dynamically positioned and has fixed size
 - Fix display of fixed size dynamic elements on iPad
 - Fix selecting and marking of text on iPad
diff --git a/projects/player/src/app/components/element-container/element-container.component.html b/projects/player/src/app/components/element-container/element-container.component.html
index b6032f71d..4a22fe08d 100644
--- a/projects/player/src/app/components/element-container/element-container.component.html
+++ b/projects/player/src/app/components/element-container/element-container.component.html
@@ -5,9 +5,10 @@
        [style.width]="elementModel.positionProps?.dynamicPositioning && elementModel.positionProps?.fixedSize ?
                       elementModel.width + 'px' : '100%'"
        [style.height]="elementModel.positionProps?.dynamicPositioning && elementModel.positionProps?.fixedSize ?
-                      elementModel.height + 'px' : '100%'"
-       cdkOverlayOrigin #overlayOrigin="cdkOverlayOrigin">
-    <ng-template #elementComponentContainer></ng-template>
+                      elementModel.height + 'px' : '100%'">
+    <div class="element-container" cdkOverlayOrigin #overlayOrigin="cdkOverlayOrigin">
+      <ng-template #elementComponentContainer></ng-template>
+    </div>
   </div>
 </div>
 
diff --git a/projects/player/src/app/components/element-container/element-container.component.ts b/projects/player/src/app/components/element-container/element-container.component.ts
index 8c362e89b..3de1144c3 100644
--- a/projects/player/src/app/components/element-container/element-container.component.ts
+++ b/projects/player/src/app/components/element-container/element-container.component.ts
@@ -244,11 +244,7 @@ export class ElementContainerComponent implements OnInit {
   ) {
     this.markingBarPosition.left = downPosition.clientY > mouseUp.clientY ? downPosition.clientX : mouseUp.clientX;
     this.markingBarPosition.top = downPosition.clientY > mouseUp.clientY ? downPosition.clientY : mouseUp.clientY;
-    this.markingBarElementRect = this.elementModel.positionProps?.dynamicPositioning &&
-    this.elementModel.positionProps?.fixedSize &&
-    this.elementComponent.domElement.parentElement ?
-      this.elementComponent.domElement.parentElement.getBoundingClientRect() :
-      this.elementComponent.domElement.getBoundingClientRect();
+    this.markingBarElementRect = this.elementComponent.domElement.getBoundingClientRect();
     this.isMarkingBarOpen = true;
     this.nativeEventService.pointerDown
       .pipe(takeUntil(this.ngUnsubscribe), first())
-- 
GitLab