Skip to content

Commit 306b30d

Browse files
penolakushariWinded
authored andcommitted
Small tweaks to make UI less confusing, shouldn't impact previous saves in any way - UI-wise first frame is now 1 instead of 0, code wise everything is the same, + now it shouldn't be possible to go past last frame by smh_next/previous or dragging past it.
1 parent 4a2e239 commit 306b30d

5 files changed

Lines changed: 6 additions & 6 deletions

File tree

lua/smh/client.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ local function BindData(container, key)
1717
local output = Rx.Subject.create();
1818
local changing = false;
1919

20-
container:_Listen(key, function(contianer, _, value)
20+
container:_Listen(key, function(container, _, value)
2121
if not changing then
2222
changing = true;
2323
output(value);

lua/smh/client/concommands.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ local function Setup()
1414

1515
concommand.Add("smh_next", function()
1616
local pos = SMH.Data.Position + 1;
17-
if pos > SMH.Data.PlaybackLength then
17+
if pos >= SMH.Data.PlaybackLength then
1818
pos = 0;
1919
end
2020
SMH.Data.Position = pos;
@@ -23,7 +23,7 @@ local function Setup()
2323
concommand.Add("smh_previous", function()
2424
local pos = SMH.Data.Position - 1;
2525
if pos < 0 then
26-
pos = SMH.Data.PlaybackLength;
26+
pos = SMH.Data.PlaybackLength - 1;
2727
end
2828
SMH.Data.Position = pos;
2929
end);

lua/smh/client/derma/frame_pointer.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ local function Create(parent, pointyBottom)
134134
local width = endX - startX;
135135

136136
local targetPos = math.Round(scrollOffset + (targetX / width) * zoom);
137-
targetPos = targetPos < 0 and 0 or (targetPos > totalFrames and totalFrames - 1 or targetPos);
137+
targetPos = targetPos < 0 and 0 or (targetPos > totalFrames - 1 and totalFrames - 1 or targetPos);
138138

139139
distinctOutputPositionStream(targetPos);
140140

lua/smh/client/derma/smh_menu.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ local function Setup(parent)
227227
local combinedPositionStream = Rx.BehaviorSubject.create(0);
228228
inputPositionStream:merge(outputPositionStream):subscribe(combinedPositionStream);
229229
Rx.Observable.combineLatest(combinedPositionStream, timelineLengthStream)
230-
:map(function(position, timelineLength) return "Position: " .. position .. " / " .. timelineLength end)
230+
:map(function(position, timelineLength) return "Position: " .. (position + 1) .. " / " .. timelineLength end)
231231
:subscribe(function(text)
232232
positionLabel:SetText(text);
233233
positionLabel:SizeToContents();

lua/smh/server/playback.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ hook.Add("Think", "SMHPlaybackTick", function()
1010
pb.Position = pb.Position + FrameTime() * pb.PlaybackRate;
1111
local newPos = math.floor(pb.Position);
1212

13-
if newPos > pb.PlaybackLength then
13+
if newPos > pb.PlaybackLength - 1 then
1414
pb.Position = 0;
1515
newPos = 0;
1616
end

0 commit comments

Comments
 (0)