Skip to content

Commit bd9ae2e

Browse files
committed
Limit AdjustmentBar drag-ability
Solution retains backwards compatibility with prior versions' config files.
1 parent 5f704ba commit bd9ae2e

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

src/prompter/Prompter.qml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ Flickable {
165165
readonly property real __curvature: viewport.__curvature / 100
166166
//property int __lastRecordedPosition: 0
167167
//property real customContentsPlacement: 0.1
168-
property real contentsPlacement: 0
168+
property real contentsPlacement: 0.02
169169
property int __tikTok: 0
170170
// Background
171171
property double __opacity: root.__opacity
@@ -254,8 +254,8 @@ Flickable {
254254
}
255255
Settings {
256256
category: "prompterPlacement"
257-
property alias width: prompter.contentsPlacement
258-
property alias offset: positionHandler.placement
257+
property alias width_v2d0: prompter.contentsPlacement
258+
property alias offset_v2d0: positionHandler.placement
259259
}
260260
Settings {
261261
category: "files"
@@ -447,8 +447,7 @@ Flickable {
447447
}
448448

449449
function setContentWidth() {
450-
//contentsPlacement = Math.abs(editor.x)/prompter.width
451-
contentsPlacement = (Math.abs(editor.x)-fontSize/2)/(prompter.width-fontSize)
450+
contentsPlacement = Math.abs(editor.x - 20) / prompter.width
452451
const offset = 0
453452
positionHandler.placement = (2 * (editor.x - 2 * offset) + editor.width - positionHandler.width) / positionHandler.width
454453
}
@@ -738,7 +737,7 @@ Flickable {
738737
//Different styles have different padding and background
739738
//decorations, but since this editor must resemble the
740739
//teleprompter output, we don't need them.
741-
x: fontSize/2 + contentsPlacement*(prompter.width-fontSize)
740+
x: contentsPlacement*(prompter.width) + 20
742741

743742
// Width drag controls
744743
width: prompter.width-2*Math.abs(x)
@@ -1172,13 +1171,13 @@ Flickable {
11721171
drag.target: editor
11731172
drag.axis: Drag.XAxis
11741173
drag.smoothed: false
1175-
drag.minimumX: fontSize/8 //: -prompter.width*6/20 + width
1176-
drag.maximumX: prompter.width*9/20 //: -fontSize/8 + width
1174+
drag.minimumX: 20
1175+
drag.maximumX: prompter.width*9/20
11771176
onReleased: prompter.setContentWidth()
11781177
onEntered: hovered = true
11791178
onExited: hovered = false
11801179
onDoubleClicked: {
1181-
prompter.contentsPlacement = 0;
1180+
prompter.contentsPlacement = 0.02;
11821181
}
11831182
property bool hovered: false
11841183
Loader {
@@ -1206,14 +1205,14 @@ Flickable {
12061205
drag.target: positionHandler
12071206
drag.axis: Drag.XAxis
12081207
drag.smoothed: false
1209-
drag.minimumX: -editor.x + fontSize/8 //prompter.width - editor.x - editor.width - leftWidthAdjustmentBar.drag.maximumX
1210-
drag.maximumX: prompter.width - editor.x - parent.width - leftWidthAdjustmentBar.drag.minimumX - fontSize/6
1208+
drag.minimumX: -editor.x + leftWidthAdjustmentBar.drag.minimumX //prompter.width - editor.x - editor.width - leftWidthAdjustmentBar.drag.maximumX
1209+
drag.maximumX: prompter.width - editor.x - parent.width - leftWidthAdjustmentBar.drag.minimumX - 13
12111210
cursorShape: (pressed||drag.active||prompter.dragging) ? Qt.ClosedHandCursor : flicking ? Qt.OpenHandCursor : Qt.OpenHandCursor
12121211
onEntered: hovered = true
12131212
onExited: hovered = false
12141213
onDoubleClicked: {
12151214
positionHandler.placement = 0;
1216-
prompter.contentsPlacement = 0;
1215+
prompter.contentsPlacement = 0.02;
12171216
}
12181217
property bool hovered: false
12191218
Loader {

0 commit comments

Comments
 (0)