Skip to content

Commit

Permalink
wally fix, old topbar offset fix, rounded corners fix, new fromSource…
Browse files Browse the repository at this point in the history
… and sourceIcon
  • Loading branch information
1ForeverHD committed Apr 1, 2024
1 parent 9a212e7 commit e692947
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 45 deletions.
2 changes: 1 addition & 1 deletion default.project.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "TopbarPlus",
"name": "topbarplus",
"tree": {
"$className": "DataModel",

Expand Down
2 changes: 1 addition & 1 deletion src/Icon/Elements/Container.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ return function(Icon)
end)

local holders = Instance.new("Frame")
local yDownOffset = if isOldTopbar then 1 else 0
local yDownOffset = if isOldTopbar then 2 else 0
local ySizeOffset = -2
if isConsoleScreen then
yDownOffset += 13
Expand Down
2 changes: 1 addition & 1 deletion src/Icon/Features/Overflow.lua
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ function Overflow.updateBoundary(alignment)
overflowIcon:autoDeselect(false)
overflowIcon.isAnOverflow = true
--overflowIcon:freezeMenu()
overflowIcon:select()
overflowIcon:select("OverflowStart", overflowIcon)
overflowIcon:setEnabled(false)
overflowIcons[alignment] = overflowIcon
overflowIconUIDs[overflowIcon.UID] = true
Expand Down
2 changes: 1 addition & 1 deletion src/Icon/Features/Themes/Classic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ return {
{"Widget", "MinimumWidth", 32, "Deselected"},
{"Widget", "MinimumHeight", 32, "Deselected"},
{"Widget", "BorderSize", 0, "Deselected"},
{"IconCorners", "CornerRadius", UDim.new(0.25, 0), "Deselected"},
{"IconCorners", "CornerRadius", UDim.new(0, 9), "Deselected"},
{"IconButton", "BackgroundTransparency", 0.5, "Deselected"},
{"IconLabel", "TextSize", 14, "Deselected"},
{"Dropdown", "BackgroundTransparency", 0.5, "Deselected"},
Expand Down
2 changes: 1 addition & 1 deletion src/Icon/VERSION.lua
Original file line number Diff line number Diff line change
@@ -1 +1 @@
return "v3.0.0"
return "v3.0.1"
48 changes: 24 additions & 24 deletions src/Icon/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,9 @@ function Icon.new()
return
end
if self.isSelected then
self:deselect(self)
self:deselect("User", self)
else
self:select(self)
self:select("User", self)
end
end
local isTouchTapping = false
Expand Down Expand Up @@ -323,7 +323,7 @@ function Icon.new()
self.isViewing = true
self.viewingStarted:Fire(true)
if not dontSetState then
self:setState("Viewing", self)
self:setState("Viewing", "User", self)
end
end
local function viewingEnded()
Expand All @@ -332,7 +332,7 @@ function Icon.new()
end
self.isViewing = false
self.viewingEnded:Fire(true)
self:setState(nil, self)
self:setState(nil, "User", self)
end
self.joinedParent:Connect(function()
if self.isViewing then
Expand Down Expand Up @@ -375,7 +375,7 @@ function Icon.new()
-- Deselect when another icon is selected
janitor:add(anyIconSelected:Connect(function(incomingIcon)
if incomingIcon ~= self and self.deselectWhenOtherIconSelected and incomingIcon.deselectWhenOtherIconSelected then
self:deselect()
self:deselect("AutoDeselect", incomingIcon)
end
end))

Expand Down Expand Up @@ -414,7 +414,7 @@ function Icon.new()
-- If an icon within a menu or dropdown is also
-- a dropdown or menu, then close it
for _, _ in pairs(childIcon.childIconsDict) do
childIcon:deselect()
childIcon:deselect("HideParentFeature", self)
end
end
end
Expand Down Expand Up @@ -478,7 +478,7 @@ function Icon:setName(name)
return self
end

function Icon:setState(incomingStateName, fromInput)
function Icon:setState(incomingStateName, fromSource, sourceIcon)
-- This is responsible for acknowleding a change in stage (such as from "Deselected" to "Viewing" when
-- a users mouse enters the widget), then informing other systems of this state change to then act upon
-- (such as the theme handler applying the theme which corresponds to that state).
Expand All @@ -495,20 +495,20 @@ function Icon:setState(incomingStateName, fromInput)
if stateName == "Deselected" then
self.isSelected = false
if currentIsSelected then
self.toggled:Fire(false, fromInput)
self.deselected:Fire(fromInput)
self.toggled:Fire(false, fromSource, sourceIcon)
self.deselected:Fire(fromSource, sourceIcon)
end
self:_setToggleItemsVisible(false, fromInput)
self:_setToggleItemsVisible(false, fromSource, sourceIcon)
elseif stateName == "Selected" then
self.isSelected = true
if not currentIsSelected then
self.toggled:Fire(true, fromInput)
self.selected:Fire(fromInput)
anyIconSelected:Fire(self)
self.toggled:Fire(true, fromSource, sourceIcon)
self.selected:Fire(fromSource, sourceIcon)
anyIconSelected:Fire(self, fromSource, sourceIcon)
end
self:_setToggleItemsVisible(true, fromInput)
self:_setToggleItemsVisible(true, fromSource, sourceIcon)
end
self.stateChanged:Fire(stateName, fromInput)
self.stateChanged:Fire(stateName, fromSource, sourceIcon)
end

function Icon:getInstance(name)
Expand Down Expand Up @@ -688,13 +688,13 @@ function Icon:setEnabled(bool)
return self
end

function Icon:select(fromInput)
self:setState("Selected", fromInput)
function Icon:select(fromSource, sourceIcon)
self:setState("Selected", fromSource, sourceIcon)
return self
end

function Icon:deselect(fromInput)
self:setState("Deselected", fromInput)
function Icon:deselect(fromSource, sourceIcon)
self:setState("Deselected", fromSource, sourceIcon)
return self
end

Expand Down Expand Up @@ -860,9 +860,9 @@ function Icon:_updateSelectionInstances()
end
end

function Icon:_setToggleItemsVisible(bool, fromInput)
function Icon:_setToggleItemsVisible(bool, fromSource, sourceIcon)
for toggleItem, _ in pairs(self.toggleItems) do
if not fromInput or fromInput == self or fromInput.toggleItems[toggleItem] == nil then
if not sourceIcon or sourceIcon == self or sourceIcon.toggleItems[toggleItem] == nil then
local property = "Visible"
if toggleItem:IsA("LayerCollector") then
property = "Enabled"
Expand Down Expand Up @@ -957,7 +957,7 @@ function Icon:oneClick(bool)
singleClickJanitor:clean()
if bool or bool == nil then
singleClickJanitor:add(self.selected:Connect(function()
self:deselect()
self:deselect("OneClick", self)
end))
end
self.oneClickEnabled = true
Expand Down Expand Up @@ -1015,9 +1015,9 @@ end
function Icon:freezeMenu()
-- A frozen menu is a menu which is permanently locked in the
-- the selected state (with its toggle hidden)
self:select()
self:select("FrozenMenu", self)
self:bindEvent("deselected", function(icon)
icon:select()
icon:select("FrozenMenu", self)
end)
self:modifyTheme({"IconSpot", "Visible", false})
end
Expand Down
8 changes: 8 additions & 0 deletions wally.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This file is automatically @generated by Wally.
# It is not intended for manual editing.
registry = "test"

[[package]]
name = "1foreverhd/topbarplus"
version = "3.0.0"
dependencies = []
24 changes: 8 additions & 16 deletions wally.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,16 @@
name = "1foreverhd/topbarplus"
description = "Construct dynamic and intuitive topbar icons. Enhance the appearance and behaviour of these icons with features such as themes, dropdowns and menus."
license = "MPL2"
version = "3.0.0"
version = "3.0.1"
registry = "https://github.com/UpliftGames/wally-index"
realm = "shared"
exclude = [
".github",
".vscode",
"assets",
"docs",
"site",
".gitattributes",
".gitignore",
"aftman.toml",
"Icon.rbxm",
"mkdocs.yml",
"selene.toml",
"sourcemap.json",
"withLink.project.json",
"src/PackageLink.model.json",
exclude = ["**"]
include = [
"default.project.json",
"src",
"src/**",
"LICENSE",
"wally.toml",
]

[dependencies]

0 comments on commit e692947

Please sign in to comment.