Skip to content

Commit

Permalink
forgot we don't need this nonsense anymore, yay
Browse files Browse the repository at this point in the history
  • Loading branch information
fx committed Sep 9, 2024
1 parent 19545cb commit 9d615b8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 45 deletions.
22 changes: 0 additions & 22 deletions public/weak_aura/dynamic_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,6 @@ class DynamicGroup < Node # rubocop:disable Metrics/ClassLength,Style/Documentat
option :icon_height, default: nil

def as_json # rubocop:disable Metrics/MethodLength
custom_grow = <<-LUA
function(newPositions, activeRegions)
local spaceX = #{options[:space][:x]}
local spaceY = #{options[:space][:y]}
local gridNum = 4
local count, x, y = 0, 0, 0
for i, regionData in ipairs(activeRegions) do
local region = regionData.region
local regionWidth = region.width or 0
local regionHeight = region.height or 0
if count > 0 and count % gridNum == 0 then
y = y + 1
x = 0
end
newPositions[i] = {(regionWidth + spaceX) * x, (regionHeight + spaceY) * y}
count = count + 1
x = x + 1
end
end
LUA

{
anchorFrameType: 'PRD',
grow: 'GRID',
Expand Down Expand Up @@ -126,7 +105,6 @@ def as_json # rubocop:disable Metrics/MethodLength
],
parent: parent.id,
animate: true,
customGrow: custom_grow,
scale: options[:scale],
centerType: 'LR',
border: false,
Expand Down
23 changes: 0 additions & 23 deletions public/weak_aura/dynamic_group_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,4 @@
require './spec/spec_helper'

RSpec.describe WeakAura::DynamicGroup do
it 'has sane defaults' do
wa = WeakAura.new(type: WhackAura)
wa.instance_eval do
dynamic_group 'Test' do
end
end
group = wa.children.first.as_json
expect(group[:customGrow]).to match(/spaceX = 2/)
expect(group[:customGrow]).to match(/spaceY = 2/)
end

it 'allows setting spaceX and spaceY of the LUA function' do
wa = WeakAura.new(type: WhackAura)
wa.instance_eval do
dynamic_group 'Test' do
space x: 666, y: 666
end
end
group = wa.children.first.as_json
expect(group[:grow]).to eq('CUSTOM')
expect(group[:customGrow]).to match(/spaceX = 666/)
expect(group[:customGrow]).to match(/spaceY = 666/)
end
end

0 comments on commit 9d615b8

Please sign in to comment.