Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select Instances from diff tree #709

Merged
merged 11 commits into from
Jul 9, 2023
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
* Fixed disconnected session activity. ([#675])
* Skip confirming patches that contain only a datamodel name change. ([#688])
* Added protection against syncing a model to a place. ([#691])
* Select Instances from diff tree view ([#709])

[#668]: https://github.com/rojo-rbx/rojo/pull/668
[#674]: https://github.com/rojo-rbx/rojo/pull/674
[#675]: https://github.com/rojo-rbx/rojo/pull/675
[#688]: https://github.com/rojo-rbx/rojo/pull/688
[#691]: https://github.com/rojo-rbx/rojo/pull/691
[#709]: https://github.com/rojo-rbx/rojo/pull/709

## [7.3.0] - April 22, 2023
* Added `$attributes` to project format. ([#574])
Expand Down Expand Up @@ -577,4 +579,4 @@ This is a general maintenance release for the Rojo 0.5.x release series.
* More robust syncing with a new reconciler

## [0.1.0](https://github.com/rojo-rbx/rojo/releases/tag/v0.1.0) (November 29, 2017)
* Initial release, functionally very similar to [rbxfs](https://github.com/LPGhatguy/rbxfs)
* Initial release, functionally very similar to [rbxfs](https://github.com/LPGhatguy/rbxfs)
58 changes: 43 additions & 15 deletions plugin/src/App/Components/PatchVisualizer/DomLabel.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
local SelectionService = game:GetService("Selection")
local StudioService = game:GetService("StudioService")

local Rojo = script:FindFirstAncestor("Rojo")
Expand All @@ -14,6 +15,7 @@ local bindingUtil = require(Plugin.App.bindingUtil)
local e = Roact.createElement

local ChangeList = require(script.Parent.ChangeList)
local Tooltip = require(script.Parent.Parent.Tooltip)

local Expansion = Roact.Component:extend("Expansion")

Expand Down Expand Up @@ -106,21 +108,47 @@ function DomLabel:render()
PaddingLeft = UDim.new(0, 10),
PaddingRight = UDim.new(0, 10),
}),
ExpandButton = if props.changeList
then e("TextButton", {
BackgroundTransparency = 1,
Text = "",
Size = UDim2.new(1, 0, 1, 0),
[Roact.Event.Activated] = function()
self.expanded = not self.expanded
local goalHeight = 30 + (if self.expanded then math.clamp(#self.props.changeList * 30, 30, 30 * 6) else 0)
self.motor:setGoal(Flipper.Spring.new(goalHeight, {
frequency = 5,
dampingRatio = 1,
}))
end,
})
else nil,
Button = e("TextButton", {
BackgroundTransparency = 1,
Text = "",
Size = UDim2.new(1, 0, 1, 0),
[Roact.Event.Activated] = function(_rbx: Instance, _input: InputObject, clickCount: number)
if clickCount == 1 then
-- Double click opens the instance in explorer
self.lastDoubleClickTime = os.clock()
if props.instance then
SelectionService:Set({ props.instance })
end
elseif clickCount == 0 then
-- Single click expands the changes
task.wait(0.25)
if os.clock() - (self.lastDoubleClickTime or 0) <= 0.25 then
-- This is a double click, so don't expand
return
end

if props.changeList then
self.expanded = not self.expanded
local goalHeight = 30
+ (if self.expanded then math.clamp(#self.props.changeList * 30, 30, 30 * 6) else 0)
self.motor:setGoal(Flipper.Spring.new(goalHeight, {
frequency = 5,
dampingRatio = 1,
}))
end
end
end,
}, {
StateTip = if (props.instance or props.changeList)
then e(Tooltip.Trigger, {
text = (if props.changeList
then "Click to " .. (if self.expanded then "hide" else "view") .. " changes"
else "") .. (if props.instance
then (if props.changeList then " & d" else "D") .. "ouble click to open in Explorer"
else ""),
})
else nil,
}),
Expansion = if props.changeList
then e(Expansion, {
rendered = self.state.renderExpansion,
Expand Down
4 changes: 4 additions & 0 deletions plugin/src/App/Components/PatchVisualizer/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ local function Tree()
id = ancestorId,
className = value.ClassName,
name = value.Name,
instance = if typeof(value) == "Instance" then value else nil,
})
previousId = ancestorId
end
Expand Down Expand Up @@ -235,6 +236,7 @@ function PatchVisualizer:buildTree(patch, instanceMap)
patchType = "Edit",
className = instance.ClassName,
name = instance.Name,
instance = instance,
hint = hint,
changeList = changeList,
})
Expand Down Expand Up @@ -263,6 +265,7 @@ function PatchVisualizer:buildTree(patch, instanceMap)
patchType = "Remove",
className = instance.ClassName,
name = instance.Name,
instance = instance,
})
end

Expand Down Expand Up @@ -362,6 +365,7 @@ function PatchVisualizer:render()
setElementHeight = setElementHeight,
patchType = node.patchType,
className = node.className,
instance = node.instance,
name = node.name,
hint = node.hint,
changeList = node.changeList,
Expand Down