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

Commit b046e33

Browse files
committed
Added text alignment.
1 parent b36d45d commit b046e33

File tree

4 files changed

+59
-25
lines changed

4 files changed

+59
-25
lines changed

src/Workspace/SignsInternal/PluginGui/HorizontalAlignment.lua renamed to src/Workspace/SignsInternal/PluginGui/TextXAlignment.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
local choices = {
22

33
{Id = "1",
4-
Mode = Enum.HorizontalAlignment.Left,
4+
Mode = Enum.TextXAlignment.Left,
55
Text = "Left",
66
},
77
{Id = "2",
8-
Mode = Enum.HorizontalAlignment.Center,
8+
Mode = Enum.TextXAlignment.Center,
99
Text = "Center",
1010
},
1111
{Id = "3",
12-
Mode = Enum.HorizontalAlignment.Right,
12+
Mode = Enum.TextXAlignment.Right,
1313
Text = "Right",
1414
},
1515

src/Workspace/SignsInternal/PluginGui/VerticalAlignment.lua renamed to src/Workspace/SignsInternal/PluginGui/TextYAlignment.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
local choices = {
22

33
{Id = "1",
4-
Mode = Enum.VerticalAlignment.Top,
4+
Mode = Enum.TextYAlignment.Top,
55
Text = "Top",
66
},
77
{Id = "2",
8-
Mode = Enum.VerticalAlignment.Center,
8+
Mode = Enum.TextYAlignment.Center,
99
Text = "Center",
1010
},
1111
{Id = "3",
12-
Mode = Enum.VerticalAlignment.Bottom,
12+
Mode = Enum.TextYAlignment.Bottom,
1313
Text = "Bottom",
1414
},
1515

src/Workspace/SignsInternal/PluginGui/init.lua

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ local Color = require(script.Color)
1919
local FontFace = require(script.FontFace)
2020
local GuiObjectPart = require(script.GuiObjectPart)
2121
local LineJoinMode = require(script.LineJoinMode)
22-
local HorizontalAlignment = require(script.HorizontalAlignment)
23-
local VerticalAlignment = require(script.VerticalAlignment)
22+
local TextXAlignment = require(script.TextXAlignment)
23+
local TextYAlignment = require(script.TextYAlignment)
2424

2525
local PluginGui = {}
2626

@@ -157,6 +157,22 @@ function PluginGui:newPluginGui(widgetGui)
157157
)
158158
listFrame:AddChild(alignmentCollapse:GetSectionFrame()) -- add child to expanding VerticallyScalingListFrame
159159

160+
local yChoice = LabeledMultiChoice.new(
161+
"yChoice", -- name suffix of gui object
162+
"Horizontal Alignment", -- title text of the multi choice
163+
TextYAlignment, -- choices array
164+
2 -- the starting index of the selection
165+
)
166+
yChoice:GetFrame().Parent = alignmentCollapse:GetContentsFrame()
167+
168+
local xChoice = LabeledMultiChoice.new(
169+
"xChoice", -- name suffix of gui object
170+
"Vertical Alignment", -- title text of the multi choice
171+
TextXAlignment, -- choices array
172+
2 -- the starting index of the selection
173+
)
174+
xChoice:GetFrame().Parent = alignmentCollapse:GetContentsFrame()
175+
160176
local strokeCollapse = CollapsibleTitledSection.new( -- Fonts collapse
161177
"strokeCollapse", -- name suffix of the gui object
162178
"Stroke", -- the text displayed beside the collapsible arrow
@@ -325,27 +341,37 @@ function PluginGui:newPluginGui(widgetGui)
325341
end)
326342

327343
colorTextChoice:SetValueChangedFunction(function(newIndex)
328-
local color = Color[newIndex].Color
329-
CustomTextLabel:UpdateTextColor3(color)
344+
local newValue = Color[newIndex].Color
345+
CustomTextLabel:UpdateTextColor3(newValue)
330346
end)
331347

332348
fontTextChoice:SetValueChangedFunction(function(newIndex)
333-
local font = FontFace[newIndex].Font
334-
CustomTextLabel:UpdateFontFace(font)
349+
local newValue = FontFace[newIndex].Font
350+
CustomTextLabel:UpdateFontFace(newValue)
351+
end)
352+
353+
yChoice:SetValueChangedFunction(function(newIndex)
354+
local newValue = TextYAlignment[newIndex].Mode
355+
CustomTextLabel:UpdateVerticalAlignment(newValue)
356+
end)
357+
358+
xChoice:SetValueChangedFunction(function(newIndex)
359+
local newValue = TextXAlignment[newIndex].Mode
360+
CustomTextLabel:UpdateHorizontalAlignment(newValue)
335361
end)
336362

337363
strokeCheckbox:SetValueChangedFunction(function(newValue)
338364
CustomTextLabel:UpdateStroke(newValue)
339365
end)
340366

341367
colorStrokeChoice:SetValueChangedFunction(function(newIndex)
342-
local color = Color[newIndex].Color
343-
CustomTextLabel:UpdateStrokeColor(color)
368+
local newValue = Color[newIndex].Color
369+
CustomTextLabel:UpdateStrokeColor(newValue)
344370
end)
345371

346372
joinStrokeChoice:SetValueChangedFunction(function(newIndex)
347-
local join = LineJoinMode[newIndex].Mode
348-
CustomTextLabel:UpdateStrokeJoin(join)
373+
local newValue = LineJoinMode[newIndex].Mode
374+
CustomTextLabel:UpdateStrokeJoin(newValue)
349375
end)
350376

351377
thicknessStrokeSlider:SetValueChangedFunction(function(newValue)
@@ -361,8 +387,8 @@ function PluginGui:newPluginGui(widgetGui)
361387
end)
362388

363389
colorBackgroundChoice:SetValueChangedFunction(function(newIndex)
364-
local color = Color[newIndex].Color
365-
CustomTextLabel:UpdateBackgroundColor3(color)
390+
local newValue = Color[newIndex].Color
391+
CustomTextLabel:UpdateBackgroundColor3(newValue)
366392
end)
367393
end
368394

src/Workspace/SignsInternal/StudioWidgets/CustomTextLabel.lua

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@ function CustomTextLabelClass.new(nameSuffix, height)
104104
label.FontFace = newValue
105105
end
106106

107+
function CustomTextLabelClass:UpdateVerticalAlignment(newValue: Enum.VerticalAlignment)
108+
label.TextYAlignment = newValue
109+
end
110+
111+
function CustomTextLabelClass:UpdateHorizontalAlignment(newValue: Enum.HorizontalAlignment)
112+
label.TextXAlignment = newValue
113+
end
114+
107115
-- function CustomTextLabelClass:UpdateTextStrokeTransparency(newValue: number)
108116
-- label.TextStrokeTransparency = newValue
109117
-- end
@@ -143,15 +151,15 @@ function CustomTextLabelClass.new(nameSuffix, height)
143151
self._frame = frame
144152
self._label = label
145153

146-
function CustomTextLabelClass:GetLabel()
147-
return label
148-
end
154+
return self
155+
end
149156

150-
function CustomTextLabelClass:GetFrame()
151-
return frame
152-
end
157+
function CustomTextLabelClass:GetLabel()
158+
return self._label
159+
end
153160

154-
return self
161+
function CustomTextLabelClass:GetFrame()
162+
return self._frame
155163
end
156164

157165
return CustomTextLabelClass

0 commit comments

Comments
 (0)