Skip to content
This repository was archived by the owner on Aug 7, 2025. It is now read-only.

Commit 1ec1d76

Browse files
authored
make mobile button actually draggable on mobile, remove button notification (#32) (@1dontgiveaf)
* use better method * Update Window.luau * test * Update Window.luau * fix typo * assign correct vars * minor mixup * fix icons * add this code back because i forgot the minimize button exists
1 parent 915fa13 commit 1ec1d76

File tree

1 file changed

+32
-23
lines changed

1 file changed

+32
-23
lines changed

Src/Components/Window.luau

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ return function(Config)
4343
local Dragging, DragInput, MousePos, StartPos = false
4444
local Resizing, ResizePos = false
4545
local MinimizeNotif = false
46-
local IsDraggingHideButton, DragInput, DragStart, DragStartPos = false
46+
local IsDraggingHideButton, DragInputHideButton, DragStart, DragStartPos = false
4747

4848
Window.AcrylicPaint = Acrylic.AcrylicPaint()
4949
Window.TabWidth = Config.TabWidth
@@ -298,10 +298,6 @@ return function(Config)
298298
end
299299
end
300300

301-
if Input.UserInputType == Enum.UserInputType.MouseMovement and IsDraggingHideButton then
302-
DragInput = Input
303-
end
304-
305301
if
306302
(Input.UserInputType == Enum.UserInputType.MouseMovement or Input.UserInputType == Enum.UserInputType.Touch)
307303
and Resizing
@@ -350,15 +346,12 @@ return function(Config)
350346
Duration = 6
351347
})
352348
end
353-
354349
if Library.Utilities:GetOS() == "Mobile" then
355350
local Icon = Config.Mobile.GetIcon(Window.Minimized)
356-
357351
Window.HideButton.Image = Icon.Image
358352
Window.HideButton.ImageRectOffset = Icon.ImageRectOffset
359-
Window.HideButton.ImageRectSize = Icon.ImageRectSize
353+
Window.HideButton.ImageRectSize = Icon.ImageRectSiz
360354
end
361-
362355
Window.PostMinimized:Fire(tick(), Window.Root.Visible)
363356
end
364357

@@ -377,35 +370,51 @@ return function(Config)
377370
end)
378371

379372
Creator.AddSignal(Window.HideButton.InputBegan, function(Input)
380-
if Input.UserInputType == Enum.UserInputType.MouseButton1 then
373+
if
374+
Input.UserInputType == Enum.UserInputType.MouseButton1
375+
or Input.UserInputType == Enum.UserInputType.Touch
376+
then
381377
IsDraggingHideButton = true
382378
DragStart = Input.Position
383-
StartPos = Window.HideButton.Position
384-
385-
local DragThread = task.spawn(function()
386-
while Library.Loaded and IsDraggingHideButton and DragInput and task.wait() do
387-
local delta = DragInput.Position - DragStart
388-
Window.HideButton.Position = UDim2.new(StartPos.X.Scale, StartPos.X.Offset + delta.X, StartPos.Y.Scale, StartPos.Y.Offset + delta.Y)
389-
end
390-
end)
379+
DragStartPos = Window.HideButton.Position
391380

392-
local InputEnded; InputEnded = Input.Changed:Connect(function()
381+
Input.Changed:Connect(function()
393382
if Input.UserInputState == Enum.UserInputState.End then
394383
IsDraggingHideButton = false
395-
task.cancel(DragThread)
396-
InputEnded:Disconnect()
397384
end
398385
end)
399386
end
400387
end)
401388

389+
Creator.AddSignal(Window.HideButton.InputChanged, function(Input)
390+
if
391+
Input.UserInputType == Enum.UserInputType.MouseMovement
392+
or Input.UserInputType == Enum.UserInputType.Touch
393+
then
394+
DragInputHideButton = Input
395+
end
396+
end)
397+
398+
Creator.AddSignal(UserInputService.InputChanged, function(Input)
399+
if Input == DragInputHideButton and IsDraggingHideButton then
400+
local delta = Input.Position - DragStart
401+
Window.HideButton.Position = UDim2.new(DragStartPos.X.Scale, DragStartPos.X.Offset + delta.X, DragStartPos.Y.Scale, DragStartPos.Y.Offset + delta.Y)
402+
end
403+
end)
404+
402405
if Library.Utilities:GetOS() == "Mobile" then
403406
Creator.AddSignal(Window.HideButton.TouchTap, function()
404-
Window:Minimize()
407+
Window.Minimized = not Window.Minimized
408+
Window.Root.Visible = not Window.Minimized
409+
local Icon = Config.Mobile.GetIcon(Window.Minimized)
410+
Window.HideButton.Image = Icon.Image
411+
Window.HideButton.ImageRectOffset = Icon.ImageRectOffset
412+
Window.HideButton.ImageRectSize = Icon.ImageRectSize
405413
end)
406414
else
407415
Creator.AddSignal(Window.HideButton.MouseButton1Click, function()
408-
Window:Minimize()
416+
Window.Minimized = not Window.Minimized
417+
Window.Root.Visible = not Window.Minimized
409418
end)
410419
end
411420

0 commit comments

Comments
 (0)