This repository was archived by the owner on Jul 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
local Runtime = require(script.Parent.Parent.Runtime) | ||
local create = require(script.Parent.Parent.create) | ||
|
||
--[=[ | ||
@interface HighlightOptions | ||
@within Plasma | ||
.outlineColor?: Color3 | ||
.fillColor?: Color3 | ||
.fillTransparency?: number | ||
.outlineTransparency?: number | ||
.fillMode?: HighlightFillMode | ||
]=] | ||
|
||
--[=[ | ||
@within Plasma | ||
@function highlight | ||
@param adornee Instance | ||
@param options? HighlightOptions | ||
Creates a highlight over an instance with the specified options, using the Roblox [Highlight] instance | ||
]=] | ||
return Runtime.widget(function(adornee, options) | ||
options = options or {} | ||
|
||
local refs = Runtime.useInstance(function(ref) | ||
return create("Highlight", { | ||
[ref] = "highlight", | ||
}) | ||
end) | ||
|
||
refs.highlight.Adornee = adornee | ||
|
||
Runtime.useEffect(function() | ||
refs.highlight.OutlineColor = options.outlineColor or Color3.new(1, 1, 1) | ||
refs.highlight.FillColor = options.fillColor or Color3.new(1, 0, 0) | ||
end, options.fillColor, options.outlineColor) | ||
|
||
refs.highlight.FillTransparency = options.fillTransparency or 0.5 | ||
refs.highlight.OutlineTransparency = options.outlineTransparency or 0 | ||
refs.highlight.DepthMode = options.depthMode or Enum.HighlightDepthMode.AlwaysOnTop | ||
end) |