From 05cf2b9f5ded3f943af90e6687a7b0550dfbb829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20O=2E=20Cordero=20P=C3=A9rez?= Date: Thu, 5 Dec 2024 00:16:11 -0400 Subject: [PATCH] Reference changes to allow for absolute margins Related to #297 --- src/prompter/Prompter.qml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/prompter/Prompter.qml b/src/prompter/Prompter.qml index 74513272..c94855a3 100644 --- a/src/prompter/Prompter.qml +++ b/src/prompter/Prompter.qml @@ -1,7 +1,7 @@ /**************************************************************************** ** ** QPrompt - ** Copyright (C) 2020-2023 Javier O. Cordero Pérez + ** Copyright (C) 2020-2024 Javier O. Cordero Pérez ** ** This file is part of QPrompt. ** @@ -421,7 +421,7 @@ Flickable { function setContentWidth() { //contentsPlacement = Math.abs(editor.x)/prompter.width - contentsPlacement = (Math.abs(editor.x)-fontSize/2)/(prompter.width-fontSize) + contentsPlacement = Math.abs(editor.x)/(prompter.width-fontSize) const offset = 0 positionHandler.placement = (2 * (editor.x - 2 * offset) + editor.width - positionHandler.width) / positionHandler.width } @@ -711,7 +711,7 @@ Flickable { //Different styles have different padding and background //decorations, but since this editor must resemble the //teleprompter output, we don't need them. - x: fontSize/2 + contentsPlacement*(prompter.width-fontSize) + x: contentsPlacement*(prompter.width-fontSize) // Width drag controls width: prompter.width-2*Math.abs(x) @@ -1077,7 +1077,7 @@ Flickable { drag.target: editor drag.axis: Drag.XAxis drag.smoothed: false - drag.minimumX: fontSize/2 //: -prompter.width*6/20 + width + drag.minimumX: 0 // fontSize/2 //: -prompter.width*6/20 + width drag.maximumX: prompter.width*9/20 //: -fontSize/2 + width onReleased: prompter.setContentWidth() //onClicked: (mouse) => { @@ -1102,7 +1102,7 @@ Flickable { drag.target: positionHandler drag.axis: Drag.XAxis drag.smoothed: false - drag.minimumX: -editor.x + fontSize/2 //prompter.width - editor.x - editor.width - leftWidthAdjustmentBar.drag.maximumX + drag.minimumX: -editor.x // + fontSize/2 //prompter.width - editor.x - editor.width - leftWidthAdjustmentBar.drag.maximumX drag.maximumX: prompter.width - editor.x - parent.width - leftWidthAdjustmentBar.drag.minimumX cursorShape: (pressed||drag.active||prompter.dragging) ? Qt.ClosedHandCursor : flicking ? Qt.OpenHandCursor : (contentsPlacement ? Qt.OpenHandCursor : Qt.ArrowCursor) Loader {