@quenty/highlight 2.2.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/highlight@2.2.0...@quenty/highlight@2.3.0) (2022-11-04)
7
+
8
+
9
+ ### Features
10
+
11
+ * Add ability to clone properties from a source highlight ([66dd191](https://github.com/Quenty/NevermoreEngine/commit/66dd191f103566d15982838b2ceedd16701ec991))
12
+ * Add AnimatedHighlightGroup:HighlightWithTransferredProperties(fromAdornee, toAdornee) ([bd4f3e9](https://github.com/Quenty/NevermoreEngine/commit/bd4f3e9638433264963a0cdeb8ebf0a4ff4ca099))
13
+
14
+
15
+
16
+
17
+
6
18
  # [2.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/highlight@2.1.1...@quenty/highlight@2.2.0) (2022-10-23)
7
19
 
8
20
  **Note:** Version bump only for package @quenty/highlight
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/highlight",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "Animated highlight system for the Roblox highlight object",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -28,7 +28,7 @@
28
28
  "dependencies": {
29
29
  "@quenty/baseobject": "^6.0.0",
30
30
  "@quenty/basicpane": "^7.1.0",
31
- "@quenty/blend": "^6.2.0",
31
+ "@quenty/blend": "^6.3.0",
32
32
  "@quenty/enumutils": "^3.0.0",
33
33
  "@quenty/instanceutils": "^7.1.0",
34
34
  "@quenty/loader": "^6.0.0",
@@ -42,5 +42,5 @@
42
42
  "publishConfig": {
43
43
  "access": "public"
44
44
  },
45
- "gitHead": "f167412233d2a0bcb7f91bdc6aa2f3c754bdbe79"
45
+ "gitHead": "1cf7e4838d864bdce2e5751b6c97d38bce29e9a6"
46
46
  }
@@ -58,6 +58,11 @@ function AnimatedHighlight.new()
58
58
  return self
59
59
  end
60
60
 
61
+ function AnimatedHighlight.isAnimatedHighlight(value)
62
+ return type(value) == "table" and
63
+ getmetatable(value) == AnimatedHighlight
64
+ end
65
+
61
66
  --[=[
62
67
  Sets the depth mode. Either can be:
63
68
 
@@ -72,6 +77,27 @@ function AnimatedHighlight:SetHighlightDepthMode(depthMode)
72
77
  self._highlightDepthMode.Value = depthMode
73
78
  end
74
79
 
80
+ function AnimatedHighlight:SetPropertiesFrom(sourceHighlight)
81
+ assert(AnimatedHighlight.isAnimatedHighlight(sourceHighlight), "Bad AnimatedHighlight")
82
+
83
+ self._highlightDepthMode.Value = sourceHighlight._highlightDepthMode.Value
84
+ self._fillColor.Value = sourceHighlight._fillColor.Value
85
+ self._outlineColor.Value = sourceHighlight._outlineColor.Value
86
+
87
+ -- well, this can't be very fast...
88
+ local function transferSpringValue(target, source)
89
+ target.Speed = source.Speed
90
+ target.Damper = source.Damper
91
+ target.Target = source.Target
92
+ target.Position = source.Position
93
+ target.Velocity = source.Velocity
94
+ end
95
+
96
+ transferSpringValue(self._fillTransparencySpring, sourceHighlight._fillTransparencySpring)
97
+ transferSpringValue(self._outlineTransparencySpring, sourceHighlight._outlineTransparencySpring)
98
+ transferSpringValue(self._percentVisible, sourceHighlight._percentVisible)
99
+ end
100
+
75
101
  function AnimatedHighlight:SetTransparencySpeed(speed)
76
102
  assert(type(speed) == "number", "Bad speed")
77
103
 
@@ -202,6 +202,20 @@ function AnimatedHighlightGroup:_getOrCreateHighlight(adornee)
202
202
  return highlight
203
203
  end
204
204
 
205
+ function AnimatedHighlightGroup:HighlightWithTransferredProperties(fromAdornee, toAdornee)
206
+ assert(typeof(fromAdornee) == "Instance", "Bad fromAdornee")
207
+ assert(typeof(toAdornee) == "Instance", "Bad toAdornee")
208
+
209
+ local source = self._highlights[fromAdornee]
210
+ if not source then
211
+ return self:Highlight(toAdornee)
212
+ end
213
+
214
+ local target = self:Highlight(toAdornee)
215
+ target:SetPropertiesFrom(source)
216
+ return target
217
+ end
218
+
205
219
  function AnimatedHighlightGroup:_removeHighlight(highlight)
206
220
  self._maid[highlight] = nil
207
221
  end