From 084810c348fc49c6766d5a779212a5886581faf4 Mon Sep 17 00:00:00 2001
From: Ron Lucke <lucke@elan-ev.de>
Date: Wed, 9 Oct 2024 12:31:58 +0000
Subject: [PATCH] Courseware: Leinwand Block

Closes #2867

Merge request studip/studip!3318
---
 .../components/courseware/blocks/CoursewareCanvasBlock.vue  | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/resources/vue/components/courseware/blocks/CoursewareCanvasBlock.vue b/resources/vue/components/courseware/blocks/CoursewareCanvasBlock.vue
index 24a59f5a621..21a52006940 100644
--- a/resources/vue/components/courseware/blocks/CoursewareCanvasBlock.vue
+++ b/resources/vue/components/courseware/blocks/CoursewareCanvasBlock.vue
@@ -579,8 +579,10 @@ export default {
             let input = this.$refs.textInputField;
             input.value = '';
             input.style.position = 'absolute';
-            input.style.top = this.$refs.canvas.offsetTop + y + 'px';
-            input.style.left = 320 + x + 'px';
+            const maxBottom = this.$refs.canvas.offsetTop + this.$refs.canvas.offsetHeight - 100;
+            input.style.top = y < maxBottom ? this.$refs.canvas.offsetTop + y + 'px' : maxBottom + 'px';
+            const leftMax = this.$refs.canvas.offsetLeft + this.$refs.canvas.offsetWidth - 320;
+            input.style.left = x < leftMax ? x + 'px' : leftMax + 'px';
             input.style.lineHeight = fontsize + 'px';
             input.style.fontSize = fontsize + 'px';
             input.style.width = '300px';
-- 
GitLab