@@ -20,6 +20,28 @@ function ChartResize:init()
2020
2121 local IconResizing = false
2222 local IsResizing = false
23+ local ResizeTarget = nil
24+
25+ local function IsResizeTargetVisible ()
26+ local Current = ResizeTarget
27+ if not Current then
28+ return false
29+ end
30+
31+ while Current do
32+ if Current :IsA ("GuiObject" ) and not Current .Visible then
33+ return false
34+ end
35+
36+ if Current :IsA ("LayerCollector" ) and not Current .Enabled then
37+ return false
38+ end
39+
40+ Current = Current .Parent
41+ end
42+
43+ return true
44+ end
2345
2446 local DirectionIcons = {
2547 SizeWE = "rbxassetid://18699453492" ,
@@ -48,6 +70,7 @@ function ChartResize:init()
4870
4971 local EdgeSize = 8
5072 function self .SetSizeTarget (Rbx )
73+ ResizeTarget = Rbx
5174 if not Rbx then
5275 return
5376 end
@@ -58,6 +81,15 @@ function ChartResize:init()
5881 table.clear (self .Connections )
5982
6083 table.insert (self .Connections , RunService .RenderStepped :Connect (function ()
84+ if not IsResizeTargetVisible () then
85+ if IsResizing then
86+ self .StopResizing ()
87+ else
88+ self .RemoveIcon ()
89+ end
90+ return
91+ end
92+
6193 local GUI_INSET = GuiService :GetGuiInset ()
6294
6395 local Mouse = UserInputService :GetMouseLocation ()
@@ -85,7 +117,7 @@ function ChartResize:init()
85117 end ))
86118
87119 table.insert (self .Connections , UserInputService .InputBegan :Connect (function (Input )
88- if Input .UserInputType == Enum.UserInputType.MouseButton1 and IconResizing then
120+ if Input .UserInputType == Enum.UserInputType.MouseButton1 and IconResizing and IsResizeTargetVisible () then
89121 self .StartResizing ()
90122 end
91123 end ))
@@ -110,7 +142,7 @@ function ChartResize:init()
110142 UpdateConnection = RunService .RenderStepped :Connect (function ()
111143 local Delta = UserInputService :GetMouseLocation () - StartMousePosition
112144 if IconResizing == "SizeNS" then
113- Delta *= Vector2 .new (0 , 1 )
145+ Delta *= Vector2 .new (0 , 1 )
114146 elseif IconResizing == "SizeWE" then
115147 Delta *= Vector2 .new (1 , 0 )
116148 end
@@ -169,4 +201,4 @@ local function ChartResizeInit(PacketChart)
169201 })
170202end
171203
172- return ChartResizeInit
204+ return ChartResizeInit
0 commit comments