Skip to content

Commit 631d388

Browse files
author
Elyas Benyamina
committed
SequencePlayer: Forbid "selecting" an invalid frame number
1 parent 6791f02 commit 631d388

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

meshroom/ui/qml/Viewer/SequencePlayer.qml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ FloatingPane {
130130
ToolTip.text: "Previous Frame"
131131

132132
onClicked: {
133-
m.frame -= 1;
133+
if (m.frame > 0) {
134+
m.frame -= 1;
135+
}
134136
}
135137
}
136138

@@ -161,7 +163,9 @@ FloatingPane {
161163
ToolTip.text: "Next Frame"
162164

163165
onClicked: {
164-
m.frame += 1;
166+
if (m.frame < sortedViewIds.length - 1) {
167+
m.frame += 1;
168+
}
165169
}
166170
}
167171

@@ -197,7 +201,9 @@ FloatingPane {
197201
ToolTip.text: "Previous Frame"
198202

199203
onClicked: {
200-
m.frame -= 1;
204+
if (m.frame > 0) {
205+
m.frame -= 1;
206+
}
201207
}
202208
}
203209

@@ -213,7 +219,9 @@ FloatingPane {
213219
Layout.preferredWidth: frameMetrics.width
214220

215221
onEditingFinished: {
216-
m.frame = parseInt(text);
222+
// We first assign the frame to the entered text even if it is an invalid frame number. We do it for extreme cases, for example without doing it, if we are at 0, and put a negative number, m.frame would be still 0 and nothing happens but we will still see the wrong number
223+
m.frame = parseInt(text)
224+
m.frame = Math.min((sortedViewIds.length - 1), Math.max(0, parseInt(text)));
217225
focus = false;
218226
}
219227
}
@@ -230,7 +238,9 @@ FloatingPane {
230238
ToolTip.text: "Next Frame"
231239

232240
onClicked: {
233-
m.frame += 1;
241+
if (m.frame < sortedViewIds.length - 1) {
242+
m.frame += 1;
243+
}
234244
}
235245
}
236246
}

0 commit comments

Comments
 (0)