mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-22 13:21:38 +00:00
Use new theme font/textsize
This commit is contained in:
parent
cfea77ebaf
commit
03fa1b3ab2
6 changed files with 44 additions and 57 deletions
|
|
@ -45,8 +45,8 @@ function ConflictAPIPopup:render()
|
||||||
Size = UDim2.new(1, 0, 0, 0),
|
Size = UDim2.new(1, 0, 0, 0),
|
||||||
AutomaticSize = Enum.AutomaticSize.Y,
|
AutomaticSize = Enum.AutomaticSize.Y,
|
||||||
Text = "There is already a Rojo API exposed by a Rojo plugin. Do you want to overwrite it with this one?",
|
Text = "There is already a Rojo API exposed by a Rojo plugin. Do you want to overwrite it with this one?",
|
||||||
Font = Enum.Font.GothamMedium,
|
FontFace = theme.Font.Main,
|
||||||
TextSize = 17,
|
TextSize = theme.TextSize.Medium,
|
||||||
TextColor3 = theme.Setting.NameColor,
|
TextColor3 = theme.Setting.NameColor,
|
||||||
TextXAlignment = Enum.TextXAlignment.Left,
|
TextXAlignment = Enum.TextXAlignment.Left,
|
||||||
TextWrapped = true,
|
TextWrapped = true,
|
||||||
|
|
@ -63,8 +63,8 @@ function ConflictAPIPopup:render()
|
||||||
Version.display(self.props.existingAPI.Version),
|
Version.display(self.props.existingAPI.Version),
|
||||||
self.props.existingAPI.ProtocolVersion
|
self.props.existingAPI.ProtocolVersion
|
||||||
),
|
),
|
||||||
Font = Enum.Font.Gotham,
|
FontFace = theme.Font.Thin,
|
||||||
TextSize = 15,
|
TextSize = theme.TextSize.Body,
|
||||||
TextColor3 = theme.Setting.DescriptionColor,
|
TextColor3 = theme.Setting.DescriptionColor,
|
||||||
TextXAlignment = Enum.TextXAlignment.Left,
|
TextXAlignment = Enum.TextXAlignment.Left,
|
||||||
TextTransparency = self.props.transparency,
|
TextTransparency = self.props.transparency,
|
||||||
|
|
@ -80,8 +80,8 @@ function ConflictAPIPopup:render()
|
||||||
Version.display(Config.version),
|
Version.display(Config.version),
|
||||||
Config.protocolVersion
|
Config.protocolVersion
|
||||||
),
|
),
|
||||||
Font = Enum.Font.Gotham,
|
FontFace = theme.Font.Thin,
|
||||||
TextSize = 15,
|
TextSize = theme.TextSize.Body,
|
||||||
TextColor3 = theme.Setting.DescriptionColor,
|
TextColor3 = theme.Setting.DescriptionColor,
|
||||||
TextXAlignment = Enum.TextXAlignment.Left,
|
TextXAlignment = Enum.TextXAlignment.Left,
|
||||||
TextTransparency = self.props.transparency,
|
TextTransparency = self.props.transparency,
|
||||||
|
|
|
||||||
|
|
@ -68,8 +68,8 @@ function PermissionPopup:render()
|
||||||
TextWrapped = true,
|
TextWrapped = true,
|
||||||
AutomaticSize = Enum.AutomaticSize.Y,
|
AutomaticSize = Enum.AutomaticSize.Y,
|
||||||
Text = api,
|
Text = api,
|
||||||
Font = Enum.Font.Gotham,
|
FontFace = theme.Font.Thin,
|
||||||
TextSize = 17,
|
TextSize = theme.TextSize.Medium,
|
||||||
TextColor3 = theme.Setting.NameColor,
|
TextColor3 = theme.Setting.NameColor,
|
||||||
TextXAlignment = Enum.TextXAlignment.Left,
|
TextXAlignment = Enum.TextXAlignment.Left,
|
||||||
TextTransparency = self.props.transparency,
|
TextTransparency = self.props.transparency,
|
||||||
|
|
@ -81,8 +81,8 @@ function PermissionPopup:render()
|
||||||
TextWrapped = true,
|
TextWrapped = true,
|
||||||
AutomaticSize = Enum.AutomaticSize.Y,
|
AutomaticSize = Enum.AutomaticSize.Y,
|
||||||
Text = apiDesc.Description,
|
Text = apiDesc.Description,
|
||||||
Font = Enum.Font.Gotham,
|
FontFace = theme.Font.Thin,
|
||||||
TextSize = 15,
|
TextSize = theme.TextSize.Body,
|
||||||
TextColor3 = theme.Setting.DescriptionColor,
|
TextColor3 = theme.Setting.DescriptionColor,
|
||||||
TextXAlignment = Enum.TextXAlignment.Left,
|
TextXAlignment = Enum.TextXAlignment.Left,
|
||||||
TextTransparency = self.props.transparency,
|
TextTransparency = self.props.transparency,
|
||||||
|
|
@ -99,8 +99,8 @@ function PermissionPopup:render()
|
||||||
Text = string.format("%s will be able to listen to these events:", self.props.name),
|
Text = string.format("%s will be able to listen to these events:", self.props.name),
|
||||||
TextWrapped = true,
|
TextWrapped = true,
|
||||||
AutomaticSize = Enum.AutomaticSize.Y,
|
AutomaticSize = Enum.AutomaticSize.Y,
|
||||||
Font = Enum.Font.GothamMedium,
|
FontFace = theme.Font.Main,
|
||||||
TextSize = 17,
|
TextSize = theme.TextSize.Medium,
|
||||||
TextColor3 = theme.Setting.NameColor,
|
TextColor3 = theme.Setting.NameColor,
|
||||||
TextXAlignment = Enum.TextXAlignment.Left,
|
TextXAlignment = Enum.TextXAlignment.Left,
|
||||||
TextTransparency = self.props.transparency,
|
TextTransparency = self.props.transparency,
|
||||||
|
|
@ -114,8 +114,8 @@ function PermissionPopup:render()
|
||||||
Text = string.format("%s will be able to read these properties:", self.props.name),
|
Text = string.format("%s will be able to read these properties:", self.props.name),
|
||||||
TextWrapped = true,
|
TextWrapped = true,
|
||||||
AutomaticSize = Enum.AutomaticSize.Y,
|
AutomaticSize = Enum.AutomaticSize.Y,
|
||||||
Font = Enum.Font.GothamMedium,
|
FontFace = theme.Font.Main,
|
||||||
TextSize = 17,
|
TextSize = theme.TextSize.Medium,
|
||||||
TextColor3 = theme.Setting.NameColor,
|
TextColor3 = theme.Setting.NameColor,
|
||||||
TextXAlignment = Enum.TextXAlignment.Left,
|
TextXAlignment = Enum.TextXAlignment.Left,
|
||||||
TextTransparency = self.props.transparency,
|
TextTransparency = self.props.transparency,
|
||||||
|
|
@ -129,8 +129,8 @@ function PermissionPopup:render()
|
||||||
Text = string.format("%s will be able to call these methods:", self.props.name),
|
Text = string.format("%s will be able to call these methods:", self.props.name),
|
||||||
TextWrapped = true,
|
TextWrapped = true,
|
||||||
AutomaticSize = Enum.AutomaticSize.Y,
|
AutomaticSize = Enum.AutomaticSize.Y,
|
||||||
Font = Enum.Font.GothamMedium,
|
FontFace = theme.Font.Main,
|
||||||
TextSize = 17,
|
TextSize = theme.TextSize.Medium,
|
||||||
TextColor3 = theme.Setting.NameColor,
|
TextColor3 = theme.Setting.NameColor,
|
||||||
TextXAlignment = Enum.TextXAlignment.Left,
|
TextXAlignment = Enum.TextXAlignment.Left,
|
||||||
TextTransparency = self.props.transparency,
|
TextTransparency = self.props.transparency,
|
||||||
|
|
@ -196,8 +196,8 @@ function PermissionPopup:render()
|
||||||
Size = UDim2.new(1, 0, 0, 0),
|
Size = UDim2.new(1, 0, 0, 0),
|
||||||
AutomaticSize = Enum.AutomaticSize.Y,
|
AutomaticSize = Enum.AutomaticSize.Y,
|
||||||
Text = string.format("%s is asking to use the Rojo API", self.props.name or "[Unknown]"),
|
Text = string.format("%s is asking to use the Rojo API", self.props.name or "[Unknown]"),
|
||||||
Font = Enum.Font.GothamBold,
|
FontFace = theme.Font.Bold,
|
||||||
TextSize = 17,
|
TextSize = theme.TextSize.Medium,
|
||||||
TextColor3 = theme.Setting.NameColor,
|
TextColor3 = theme.Setting.NameColor,
|
||||||
TextXAlignment = Enum.TextXAlignment.Center,
|
TextXAlignment = Enum.TextXAlignment.Center,
|
||||||
TextWrapped = true,
|
TextWrapped = true,
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ local Roact = require(Packages.Roact)
|
||||||
|
|
||||||
local Assets = require(Plugin.Assets)
|
local Assets = require(Plugin.Assets)
|
||||||
local Theme = require(Plugin.App.Theme)
|
local Theme = require(Plugin.App.Theme)
|
||||||
|
local getTextBoundsAsync = require(Plugin.App.getTextBoundsAsync)
|
||||||
|
|
||||||
local SlicedImage = require(Plugin.App.Components.SlicedImage)
|
local SlicedImage = require(Plugin.App.Components.SlicedImage)
|
||||||
|
|
||||||
|
|
@ -15,15 +16,6 @@ local e = Roact.createElement
|
||||||
|
|
||||||
local DIVIDER_FADE_SIZE = 0.1
|
local DIVIDER_FADE_SIZE = 0.1
|
||||||
|
|
||||||
local function getTextBounds(text, textSize, font, lineHeight, bounds)
|
|
||||||
local textBounds = TextService:GetTextSize(text, textSize, font, bounds)
|
|
||||||
|
|
||||||
local lineCount = textBounds.Y / textSize
|
|
||||||
local lineHeightAbsolute = textSize * lineHeight
|
|
||||||
|
|
||||||
return Vector2.new(textBounds.X, lineHeightAbsolute * lineCount - (lineHeightAbsolute - textSize))
|
|
||||||
end
|
|
||||||
|
|
||||||
local Listing = Roact.Component:extend("Listing")
|
local Listing = Roact.Component:extend("Listing")
|
||||||
|
|
||||||
function Listing:init()
|
function Listing:init()
|
||||||
|
|
@ -82,8 +74,8 @@ function Listing:render()
|
||||||
}, {
|
}, {
|
||||||
Name = e("TextLabel", {
|
Name = e("TextLabel", {
|
||||||
Text = self.props.name,
|
Text = self.props.name,
|
||||||
Font = Enum.Font.GothamBold,
|
FontFace = theme.Font.Bold,
|
||||||
TextSize = 17,
|
TextSize = theme.TextSize.Medium,
|
||||||
TextColor3 = theme.Settings.Setting.NameColor,
|
TextColor3 = theme.Settings.Setting.NameColor,
|
||||||
TextXAlignment = Enum.TextXAlignment.Left,
|
TextXAlignment = Enum.TextXAlignment.Left,
|
||||||
TextTransparency = self.props.transparency,
|
TextTransparency = self.props.transparency,
|
||||||
|
|
@ -96,21 +88,22 @@ function Listing:render()
|
||||||
|
|
||||||
Description = e("TextLabel", {
|
Description = e("TextLabel", {
|
||||||
Text = self.props.description,
|
Text = self.props.description,
|
||||||
Font = Enum.Font.Gotham,
|
FontFace = theme.Font.Thin,
|
||||||
LineHeight = 1.2,
|
LineHeight = 1.2,
|
||||||
TextSize = 14,
|
TextSize = theme.TextSize.Body,
|
||||||
TextColor3 = theme.Settings.Setting.DescriptionColor,
|
TextColor3 = theme.Settings.Setting.DescriptionColor,
|
||||||
TextXAlignment = Enum.TextXAlignment.Left,
|
TextXAlignment = Enum.TextXAlignment.Left,
|
||||||
TextTransparency = self.props.transparency,
|
TextTransparency = self.props.transparency,
|
||||||
TextWrapped = true,
|
TextWrapped = true,
|
||||||
|
|
||||||
Size = self.containerSize:map(function(value)
|
Size = self.containerSize:map(function(value)
|
||||||
local textBounds = getTextBounds(
|
local textBounds = getTextBoundsAsync(
|
||||||
self.props.description,
|
self.props.description,
|
||||||
14,
|
theme.Font.Thin,
|
||||||
Enum.Font.Gotham,
|
theme.TextSize.Body,
|
||||||
1.2,
|
value.X - 40,
|
||||||
Vector2.new(value.X - 40, math.huge)
|
false,
|
||||||
|
1.2
|
||||||
)
|
)
|
||||||
return UDim2.new(1, -40, 0, textBounds.Y)
|
return UDim2.new(1, -40, 0, textBounds.Y)
|
||||||
end),
|
end),
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,8 @@ local function Navbar(props)
|
||||||
|
|
||||||
Text = e("TextLabel", {
|
Text = e("TextLabel", {
|
||||||
Text = "Permissions",
|
Text = "Permissions",
|
||||||
Font = Enum.Font.Gotham,
|
FontFace = theme.Font.Thin,
|
||||||
TextSize = 18,
|
TextSize = theme.TextSize.Large,
|
||||||
TextColor3 = theme.TextColor,
|
TextColor3 = theme.TextColor,
|
||||||
TextTransparency = props.transparency,
|
TextTransparency = props.transparency,
|
||||||
|
|
||||||
|
|
@ -115,8 +115,8 @@ function PermissionsPage:render()
|
||||||
if next(sources) == nil then
|
if next(sources) == nil then
|
||||||
sources.noSources = e("TextLabel", {
|
sources.noSources = e("TextLabel", {
|
||||||
Text = "No third-party plugins have been granted permissions.",
|
Text = "No third-party plugins have been granted permissions.",
|
||||||
Font = Enum.Font.Gotham,
|
FontFace = theme.Font.Thin,
|
||||||
TextSize = 18,
|
TextSize = theme.TextSize.Large,
|
||||||
TextColor3 = theme.Setting.DescriptionColor,
|
TextColor3 = theme.Setting.DescriptionColor,
|
||||||
TextTransparency = self.props.transparency,
|
TextTransparency = self.props.transparency,
|
||||||
TextWrapped = true,
|
TextWrapped = true,
|
||||||
|
|
|
||||||
|
|
@ -30,21 +30,6 @@ local TAG_TYPES = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local function getTextBoundsWithLineHeight(
|
|
||||||
text: string,
|
|
||||||
font: Font,
|
|
||||||
textSize: number,
|
|
||||||
width: number,
|
|
||||||
lineHeight: number
|
|
||||||
)
|
|
||||||
local textBounds = getTextBoundsAsync(text, font, textSize, width)
|
|
||||||
|
|
||||||
local lineCount = math.ceil(textBounds.Y / textSize)
|
|
||||||
local lineHeightAbsolute = textSize * lineHeight
|
|
||||||
|
|
||||||
return Vector2.new(textBounds.X, lineHeightAbsolute * lineCount - (lineHeightAbsolute - textSize))
|
|
||||||
end
|
|
||||||
|
|
||||||
local function getThemeColorFromPath(theme, path)
|
local function getThemeColorFromPath(theme, path)
|
||||||
local color = theme
|
local color = theme
|
||||||
for _, key in path do
|
for _, key in path do
|
||||||
|
|
@ -205,11 +190,12 @@ function Setting:render()
|
||||||
inputSize = self.inputSize,
|
inputSize = self.inputSize,
|
||||||
}):map(function(values)
|
}):map(function(values)
|
||||||
local offset = values.inputSize.X + 5
|
local offset = values.inputSize.X + 5
|
||||||
local textBounds = getTextBoundsWithLineHeight(
|
local textBounds = getTextBoundsAsync(
|
||||||
self.props.description,
|
self.props.description,
|
||||||
theme.Font.Main,
|
theme.Font.Main,
|
||||||
theme.TextSize.Body,
|
theme.TextSize.Body,
|
||||||
values.containerSize.X - offset,
|
values.containerSize.X - offset,
|
||||||
|
true,
|
||||||
1.2
|
1.2
|
||||||
)
|
)
|
||||||
return UDim2.new(1, -offset, 0, textBounds.Y)
|
return UDim2.new(1, -offset, 0, textBounds.Y)
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,8 @@ local function getTextBoundsAsync(
|
||||||
font: Font,
|
font: Font,
|
||||||
textSize: number,
|
textSize: number,
|
||||||
width: number,
|
width: number,
|
||||||
richText: boolean?
|
richText: boolean?,
|
||||||
|
lineHeight: number?
|
||||||
): Vector2
|
): Vector2
|
||||||
if type(text) ~= "string" then
|
if type(text) ~= "string" then
|
||||||
Log.warn(`Invalid text. Expected string, received {type(text)} instead`)
|
Log.warn(`Invalid text. Expected string, received {type(text)} instead`)
|
||||||
|
|
@ -35,6 +36,13 @@ local function getTextBoundsAsync(
|
||||||
return Vector2.zero
|
return Vector2.zero
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if lineHeight and type(lineHeight) == "number" then
|
||||||
|
local lineCount = math.ceil(bounds.Y / textSize)
|
||||||
|
local lineHeightAbsolute = textSize * lineHeight
|
||||||
|
|
||||||
|
return Vector2.new(bounds.X, lineHeightAbsolute * lineCount - (lineHeightAbsolute - textSize))
|
||||||
|
end
|
||||||
|
|
||||||
return bounds
|
return bounds
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue