Skip to content

Commit 4ee120f

Browse files
fix: content width for now
1 parent f0d1db8 commit 4ee120f

2 files changed

Lines changed: 76 additions & 17 deletions

File tree

src/extensions/selection.luau

Lines changed: 75 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
local Selection = game:GetService("Selection")
22

33
local Extension = require("@src/Extension")
4+
local Iris = require("@src/Iris")
45
local assets = require("@src/assets")
56

67
local plugin = script:FindFirstAncestorWhichIsA("Plugin") :: Plugin
@@ -17,7 +18,8 @@ ext:newCommand({
1718
title = "Select Children",
1819
description = "Selects children of the current selection.",
1920

20-
run = function()
21+
run = function(ctx: Extension.CommandContext)
22+
ctx:recordChanges()
2123
local oldSelection = Selection:Get()
2224
local newSelection = table.clone(oldSelection)
2325
for _, selected in oldSelection do
@@ -33,7 +35,8 @@ ext:newCommand({
3335
title = "Select Descendants",
3436
description = "Selects descendants of the current selection.",
3537

36-
run = function()
38+
run = function(ctx: Extension.CommandContext)
39+
ctx:recordChanges()
3740
local oldSelection = Selection:Get()
3841
local newSelection = table.clone(oldSelection)
3942
for _, selected in oldSelection do
@@ -49,7 +52,8 @@ ext:newCommand({
4952
title = "Select Just Children",
5053
description = "Selects only the children of the current selection.",
5154

52-
run = function()
55+
run = function(ctx: Extension.CommandContext)
56+
ctx:recordChanges()
5357
local newSelection = {}
5458
for _, selected in Selection:Get() do
5559
local children = selected:GetChildren()
@@ -64,7 +68,8 @@ ext:newCommand({
6468
title = "Select Just Descendants",
6569
description = "Selects only the descendants of the current selection.",
6670

67-
run = function()
71+
run = function(ctx: Extension.CommandContext)
72+
ctx:recordChanges()
6873
local newSelection = {}
6974
for _, selected in Selection:Get() do
7075
local descendants = selected:GetDescendants()
@@ -74,22 +79,13 @@ ext:newCommand({
7479
end,
7580
})
7681

77-
ext:newCommand({
78-
id = "deselect-all",
79-
title = "Deselect All",
80-
description = "Clears your selection.",
81-
82-
run = function()
83-
Selection:Set({})
84-
end,
85-
})
86-
8782
ext:newCommand({
8883
id = "select-just-first",
8984
title = "Select Just First",
9085
description = "Reduce to just your first selection.",
9186

92-
run = function()
87+
run = function(ctx: Extension.CommandContext)
88+
ctx:recordChanges()
9389
Selection:Set({ Selection:Get()[1] })
9490
end,
9591
})
@@ -99,10 +95,73 @@ ext:newCommand({
9995
title = "Select Just Last",
10096
description = "Reduce to just your last selection.",
10197

102-
run = function()
98+
run = function(ctx: Extension.CommandContext)
99+
ctx:recordChanges()
103100
local oldSelection = Selection:Get()
104101
Selection:Set({ oldSelection[#oldSelection] })
105102
end,
106103
})
107104

105+
ext:newCommand({
106+
id = "deselect-all",
107+
title = "Deselect All",
108+
description = "Clears your selection.",
109+
110+
run = function(ctx: Extension.CommandContext)
111+
ctx:recordChanges()
112+
ctx:setSelection({})
113+
end,
114+
})
115+
116+
ext:newCommand({
117+
id = "destroy-selection",
118+
title = "Destroy Selection",
119+
description = "Destroys the selection.",
120+
121+
run = function(ctx: Extension.CommandContext)
122+
ctx:recordChanges()
123+
for _, instance in ctx:getSelection() do
124+
pcall(game.Destroy, instance)
125+
end
126+
end,
127+
})
128+
129+
ext:newCommand({
130+
id = "destroy-just-children",
131+
title = "Destroy Just Children",
132+
description = "Destroys just the children of the current selection.",
133+
134+
run = function(ctx: Extension.CommandContext)
135+
ctx:recordChanges()
136+
for _, parent in ctx:getSelection() do
137+
for _, children in parent:GetChildren() do
138+
pcall(game.Destroy, children)
139+
end
140+
end
141+
end,
142+
})
143+
144+
ext:newCommand({
145+
id = "rename-selection",
146+
title = "Rename Selection",
147+
description = "Renames the current selection to the given pattern.",
148+
149+
run = function(ctx: Extension.CommandContext)
150+
ctx:recordChanges()
151+
end,
152+
153+
renderInViewport = function(ctx: Extension.CommandContext)
154+
local window = Iris.Window({ "Rename Selection" })
155+
if window.closed() then
156+
Iris.End()
157+
ctx:cleanup()
158+
return
159+
end
160+
161+
Iris.InputText({ "Rename to..." })
162+
163+
Iris.End()
164+
end,
165+
})
166+
108167
return ext

src/theme/presets/base.luau

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ local base: types.PartialConfig = {
6464
ResizeGripActiveTransparency = 0.05,
6565

6666
ItemWidth = UDim.new(1, 0),
67-
ContentWidth = UDim.new(1, 0),
67+
-- ContentWidth = UDim.new(1, 0),
6868
ContentHeight = UDim.new(0, 0),
6969

7070
WindowPadding = Vector2.new(12, 8),

0 commit comments

Comments
 (0)