View Single Post
10-17-17, 03:03 PM   #19
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by myrroddin View Post
I will look more in depth later, but I can tell you that line 3 is not needed, as you already have the table as the second return from line 1.

Also since math.round does not exist normally, that should be a local variable; otherwise you run the risk of someone else doing something similar and cross-polluting each other.

Next you use SetSize, but you also use SetHeight and SetWidth. Use either SetSize or both SetHeight/SetWdith, not both.

frame.backdrop can be just local backdrop = blah.

Why are you securely hooking StopMovingOrSizing? I'm pretty certain you can use a normal hook for that, although you will have to exit out on InCombatLockdown().

Getting the scale on line 154 is all right, but you do not need to get the return every time the frame is resized. The scale will always be the scale. Move that line into your main chunk. You can apply the scale when the frame is resized, however.

There are possibly other things but that is at a glance.
1. It's two different table.
2. Adding math.round to the global table is not much of a risk since it should be present there. It's a good question why the hell it's not present by default?
3. I didn't use any SetHeight.
4. Yes, but if i want to access those values it better to keep this way. I personally don't use SetBackdrop at all, i use custom borders but that would be too much garbage code here.
5. Copy paste.
6. I need to get the scale every time the frames size is changed since it's get generated from the (current size / base size) formula.
  Reply With Quote