Skip to content

Commit d9787ed

Browse files
authored
Merge pull request #37 from kaaskiller/master
Update cl_seek.lua
2 parents 73696d6 + 9b146f6 commit d9787ed

File tree

1 file changed

+14
-2
lines changed
  • workshop/gamemodes/cinema_modded/gamemode/modules/scoreboard/controls

1 file changed

+14
-2
lines changed

workshop/gamemodes/cinema_modded/gamemode/modules/scoreboard/controls/cl_seek.lua

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,19 @@ function SEEKBOX:Init()
4646

4747
RunConsoleCommand( "cinema_seek", seekTime )
4848
end
49-
49+
50+
-- Handling mouse clicks on the slider because some silly people not knows you need to hold the knob like me
51+
self.SeekBar.OnMousePressed = function(panel, mousecode)
52+
local x, y = panel:CursorPos()
53+
local newSlideX = x / panel:GetWide()
54+
panel:SetSlideX(newSlideX)
55+
56+
local seekTime = ceil(newSlideX * self.Media.duration)
57+
self.TimeLbl:SetText(FormatSeconds(seekTime))
58+
59+
RunConsoleCommand("cinema_seek", seekTime)
60+
end
61+
5062
for _, child in pairs( self.SeekBar:GetChildren() ) do
5163
if child ~= self.SeekBar.Knob then
5264
child:Remove()
@@ -192,4 +204,4 @@ function SEEKBUTTONS:Paint( w, h )
192204

193205
end
194206

195-
derma.DefineControl( "TheaterSeekButtons", "", SEEKBUTTONS, "Panel" )
207+
derma.DefineControl( "TheaterSeekButtons", "", SEEKBUTTONS, "Panel" )

0 commit comments

Comments
 (0)