Skip to content

Commit

Permalink
Reference changes to allow for absolute margins
Browse files Browse the repository at this point in the history
Related to #297
  • Loading branch information
Cuperino committed Dec 5, 2024
1 parent 8da5ef9 commit 05cf2b9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/prompter/Prompter.qml
Original file line number Diff line number Diff line change
@@ -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.
**
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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) => {
Expand All @@ -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 {
Expand Down

0 comments on commit 05cf2b9

Please sign in to comment.