List of commits:
Subject Hash Author Date (UTC)
feat(choir)!: Close spoiler by pressing Esc 22d7370011ac45d25a410a3f569183d0cc9fb232 Vladyslav Bondarenko 2021-10-29 16:10:08
feat(choir)!: Range indicator 931a0510b562986ec76dc22f329f4af4ed723cdf Vladyslav Bondarenko 2021-10-29 10:40:46
fix(choir)!: Health bar in combat a6622578dd5a1b4e4babf699a4cf1e4eb6bb70d6 Vladyslav Bondarenko 2021-10-28 07:42:57
feat(choir)!: Decorate unit buttons 4dc5ed44a9519b275f4256cfe4281110b7a94c9a Vladyslav Bondarenko 2021-10-25 21:20:56
feat(choir)!: Copy action bar binding 70ce056ffda7f12d913ce9a42b128ea257bdd0dc Vladyslav Bondarenko 2021-10-23 23:34:56
feat!: Initial commit 45c4e781e5ff0a69f8b0bea3a869e2384c7ca454 Vladyslav Bondarenko 2021-10-23 06:03:14
Commit 22d7370011ac45d25a410a3f569183d0cc9fb232 - feat(choir)!: Close spoiler by pressing Esc
When unit selection spoiler is shown, user may press Esc to hide the
spoiler without pressing any of the units, and therefore keeping the
current target.

Additionally, refactor _onclick script to hopefully improve
maintainability and reliability of the code. Specifically, make sure
that regardless of how a spoiler visibility was toggled, the spoiler and
it's children buttons behave as expected.
Author: Vladyslav Bondarenko
Author date (UTC): 2021-10-29 16:10
Committer name: Vladyslav Bondarenko
Committer date (UTC): 2021-10-29 16:10
Parent(s): 811b2a500c4e740e1c2d09dcb35e21f3e6ec23f9
Signer:
Signing key:
Signing status: N
Tree: 3e2e903da7d93bf9c738e617047450cedd771c9e
File Lines added Lines deleted
choir.lua 34 11
File choir.lua changed (mode: 100644) (index a42686c..f526d66)
... ... local function createSpoiler(spoilerParent, spoilerDesignation)
240 240 local spoiler = CreateFrame('BUTTON', spoilerDesignation, spoilerParent, 'SecureHandlerClickTemplate') local spoiler = CreateFrame('BUTTON', spoilerDesignation, spoilerParent, 'SecureHandlerClickTemplate')
241 241 spoiler:EnableMouse(true) spoiler:EnableMouse(true)
242 242 spoiler:SetAttribute('_onclick', [=[ spoiler:SetAttribute('_onclick', [=[
243 --[[ Toggle sibling frames, which are other spoilers that contain unit buttons ]]--
244 local parentFrame = self:GetParent()
245 local siblingTable = parentFrame:GetChildList(newtable())
246 local i = 0
247 while (i < #siblingTable) do
248 i = i + 1
249 local sibling = siblingTable[i]
250 sibling:ClearBindings()
251 sibling:Hide()
243 --[[ Toggle the spoiler on repeated clicks. ]]--
244 if self:IsShown() then
245 self:Hide()
246 return
252 247 end end
253 248
254 --[[ Apply override bindings to children which are unit buttons of a specific raid group ]]--
249 --[[ Override binding key to toggle the spoiler on Escape key press. ]]--
250 self:SetBindingClick(true, 'CTRL-W', self)
251 self:SetBindingClick(true, 'ESCAPE', self)
255 252 self:Show() self:Show()
253
254 --[[ Apply override bindings to children which are unit buttons of a specific raid group. ]]--
256 255 local j = 0 local j = 0
257 256 local childTable = self:GetChildList(newtable()) local childTable = self:GetChildList(newtable())
258 257 while (j < #childTable) do while (j < #childTable) do
 
... ... local function createSpoiler(spoilerParent, spoilerDesignation)
267 266 end end
268 267 ]=]) ]=])
269 268
269 --[[ Toggle sibling frames, which are other spoilers that contain unit buttons ]]--
270 --[[ WARNING Make sure not to toggle this frame (self).
271 -- Otherwise wrap scripts might trigger unexpectedly. ]]--
272 spoiler:WrapScript(spoiler, 'OnShow', [=[
273 local parentFrame = self:GetParent()
274 local siblingTable = parentFrame:GetChildList(newtable())
275 local i = 0
276 while (i < #siblingTable) do
277 i = i + 1
278 local sibling = siblingTable[i]
279 if self ~= sibling then
280 sibling:Hide()
281 end
282 end
283 ]=])
284
285 --[[ Override key bindings are set when _onclick script is executed.
286 -- Reset the bindings when the frame is hidden to allow other frames,
287 -- especially nested spoilers, to re-use the keys. ]]--
288 spoiler:WrapScript(spoiler, 'OnHide', [=[
289 self:ClearBindings()
290 ]=])
291
270 292 return spoiler return spoiler
271 293 end end
272 294
 
... ... local function createGroup(rootFrame, groupNumber, unitTable)
342 364 -- which was created with createSpoiler and -- which was created with createSpoiler and
343 365 -- has required scripts hooked to it ]]-- -- has required scripts hooked to it ]]--
344 366 local spoilerFrame = self:GetParent() local spoilerFrame = self:GetParent()
345 spoilerFrame:ClearBindings()
346 367 spoilerFrame:Hide() spoilerFrame:Hide()
347 368 ]=]) ]=])
348 369 b:Hide() b:Hide()
 
... ... local function createGroup(rootFrame, groupNumber, unitTable)
357 378
358 379 _G['BINDING_NAME_CLICK ' .. spoiler:GetName() .. ':LeftButton'] = 'Group ' .. tostring(groupNumber) _G['BINDING_NAME_CLICK ' .. spoiler:GetName() .. ':LeftButton'] = 'Group ' .. tostring(groupNumber)
359 380
381 spoiler:Hide()
382
360 383 return spoiler return spoiler
361 384 end end
362 385
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/vrtc/choir

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/vrtc/choir

Clone this repository using git:
git clone git://git.rocketgit.com/user/vrtc/choir

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main