mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Add vscode-rojo submodule and update schemas for Atlas rebranding
- Added the vscode-rojo submodule to the project, linking to the UserGeneratedLLC repository. - Created a new plan for syncing vscode-rojo schemas, detailing updates to project, meta, and model schemas to align with the Rojo fork and rebrand as "Atlas". - Enhanced the Theme and DomLabel components to support subtree highlighting, improving user interaction in the PatchVisualizer. - Updated the PatchVisualizer to manage subtree highlight state and ancestor IDs for better visual feedback during selection.
This commit is contained in:
parent
aeec3a962b
commit
edfe15a143
6 changed files with 235 additions and 0 deletions
|
|
@ -116,9 +116,16 @@ function SelectionOption:render()
|
|||
ZIndex = 10,
|
||||
[Roact.Event.MouseEnter] = function()
|
||||
self:setState({ isHovered = true })
|
||||
-- Trigger subtree highlight when this button would apply to children
|
||||
if (isParentOnly or (isSelected and hasChildren)) and props.onSubtreeHoverStart then
|
||||
props.onSubtreeHoverStart()
|
||||
end
|
||||
end,
|
||||
[Roact.Event.MouseLeave] = function()
|
||||
self:setState({ isHovered = false })
|
||||
if props.onSubtreeHoverEnd then
|
||||
props.onSubtreeHoverEnd()
|
||||
end
|
||||
end,
|
||||
[Roact.Event.Activated] = function()
|
||||
if isParentOnly or (isSelected and hasChildren) then
|
||||
|
|
@ -173,6 +180,8 @@ local function SelectionRadio(props)
|
|||
layoutOrder = 1,
|
||||
hasChildren = hasChildren,
|
||||
isParentOnly = isParentOnly,
|
||||
onSubtreeHoverStart = props.onSubtreeHoverStart,
|
||||
onSubtreeHoverEnd = props.onSubtreeHoverEnd,
|
||||
onClick = function()
|
||||
if props.onSelectionChange then
|
||||
props.onSelectionChange(props.nodeId, "pull")
|
||||
|
|
@ -192,6 +201,8 @@ local function SelectionRadio(props)
|
|||
layoutOrder = 2,
|
||||
hasChildren = hasChildren,
|
||||
isParentOnly = isParentOnly,
|
||||
onSubtreeHoverStart = props.onSubtreeHoverStart,
|
||||
onSubtreeHoverEnd = props.onSubtreeHoverEnd,
|
||||
onClick = function()
|
||||
if props.onSelectionChange then
|
||||
props.onSelectionChange(props.nodeId, "ignore")
|
||||
|
|
@ -211,6 +222,8 @@ local function SelectionRadio(props)
|
|||
layoutOrder = 3,
|
||||
hasChildren = hasChildren,
|
||||
isParentOnly = isParentOnly,
|
||||
onSubtreeHoverStart = props.onSubtreeHoverStart,
|
||||
onSubtreeHoverEnd = props.onSubtreeHoverEnd,
|
||||
onClick = function()
|
||||
if props.onSelectionChange then
|
||||
props.onSelectionChange(props.nodeId, "push")
|
||||
|
|
@ -324,6 +337,17 @@ function DomLabel:render()
|
|||
local props = self.props
|
||||
local depth = props.depth or 1
|
||||
|
||||
-- Derive subtree highlight state from binding (no re-renders needed)
|
||||
local ancestorIds = props.ancestorIds
|
||||
local isSubtreeHighlighted = if props.subtreeHighlightNodeId
|
||||
then props.subtreeHighlightNodeId:map(function(highlightId)
|
||||
if highlightId == nil then
|
||||
return false
|
||||
end
|
||||
return ancestorIds[highlightId] == true
|
||||
end)
|
||||
else nil
|
||||
|
||||
return Theme.with(function(theme)
|
||||
local color = if props.isWarning
|
||||
then theme.Diff.Warning
|
||||
|
|
@ -520,6 +544,17 @@ function DomLabel:render()
|
|||
})
|
||||
else nil,
|
||||
}),
|
||||
SubtreeHighlight = if isSubtreeHighlighted
|
||||
then e("Frame", {
|
||||
Size = UDim2.fromScale(1, 1),
|
||||
BackgroundColor3 = theme.Diff.SubtreeHighlight,
|
||||
BackgroundTransparency = isSubtreeHighlighted:map(function(highlighted)
|
||||
return if highlighted then 0.92 else 1
|
||||
end),
|
||||
BorderSizePixel = 0,
|
||||
ZIndex = 0,
|
||||
})
|
||||
else nil,
|
||||
SelectionRadio = e(SelectionRadio, {
|
||||
-- Visible for nodes with patchType, or for parent-only nodes on hover
|
||||
visible = (props.patchType ~= nil and props.onSelectionChange ~= nil)
|
||||
|
|
@ -537,6 +572,16 @@ function DomLabel:render()
|
|||
isParentOnly = props.patchType == nil,
|
||||
onSelectionChange = props.onSelectionChange,
|
||||
onSubtreeSelectionChange = props.onSubtreeSelectionChange,
|
||||
onSubtreeHoverStart = function()
|
||||
if props.setSubtreeHighlightNodeId then
|
||||
props.setSubtreeHighlightNodeId(props.nodeId)
|
||||
end
|
||||
end,
|
||||
onSubtreeHoverEnd = function()
|
||||
if props.setSubtreeHighlightNodeId then
|
||||
props.setSubtreeHighlightNodeId(nil)
|
||||
end
|
||||
end,
|
||||
}),
|
||||
LineGuides = e("Folder", nil, lineGuides),
|
||||
})
|
||||
|
|
|
|||
|
|
@ -60,6 +60,9 @@ function PatchVisualizer:init()
|
|||
-- Without this, every render creates new bindings starting at 24,
|
||||
-- causing expanded rows to visually glitch when unrelated props change.
|
||||
self.nodeHeightBindings = {}
|
||||
|
||||
-- Binding for subtree hover preview: stores the nodeId whose children should highlight
|
||||
self.subtreeHighlightNodeId, self.setSubtreeHighlightNodeId = Roact.createBinding(nil)
|
||||
end
|
||||
|
||||
function PatchVisualizer:willUnmount()
|
||||
|
|
@ -180,6 +183,15 @@ function PatchVisualizer:render()
|
|||
local elementHeight = self.nodeHeightBindings[nodeId].binding
|
||||
local setElementHeight = self.nodeHeightBindings[nodeId].setBinding
|
||||
|
||||
-- Compute ancestor IDs for subtree hover highlight
|
||||
local ancestorIds = {}
|
||||
local currentParentId = node.parentId
|
||||
while currentParentId and currentParentId ~= "ROOT" do
|
||||
ancestorIds[currentParentId] = true
|
||||
local parentNode = patchTree:getNode(currentParentId)
|
||||
currentParentId = parentNode and parentNode.parentId
|
||||
end
|
||||
|
||||
elementHeights[elementIndex] = elementHeight
|
||||
scrollElements[elementIndex] = e(DomLabel, {
|
||||
transparency = self.props.transparency,
|
||||
|
|
@ -206,6 +218,10 @@ function PatchVisualizer:render()
|
|||
selection = self.props.selections and self.props.selections[node.id],
|
||||
onSelectionChange = self.props.onSelectionChange,
|
||||
onSubtreeSelectionChange = self.props.onSubtreeSelectionChange,
|
||||
-- Subtree hover highlight props
|
||||
ancestorIds = ancestorIds,
|
||||
subtreeHighlightNodeId = self.subtreeHighlightNodeId,
|
||||
setSubtreeHighlightNodeId = self.setSubtreeHighlightNodeId,
|
||||
})
|
||||
|
||||
if isFinalChild then
|
||||
|
|
|
|||
|
|
@ -237,6 +237,7 @@ function StudioProvider:updateTheme()
|
|||
Edit = Color3.fromRGB(255, 0, 255),
|
||||
|
||||
Row = studioTheme:GetColor(Enum.StudioStyleGuideColor.BrightText),
|
||||
SubtreeHighlight = if isDark then Color3.fromRGB(255, 255, 255) else Color3.fromRGB(0, 0, 0),
|
||||
Warning = studioTheme:GetColor(Enum.StudioStyleGuideColor.WarningText),
|
||||
WhitespaceOnly = if isDark then Color3.fromRGB(140, 140, 140) else Color3.fromRGB(110, 110, 110),
|
||||
Changes = if isDark then Color3.fromRGB(100, 140, 220) else Color3.fromRGB(40, 100, 180),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue