comparison HotCorners.lua @ 11:371e14cd2feb

- major fixes with icons not showing correctly.
author Tercio
date Thu, 08 Dec 2016 13:01:40 -0200
parents d8a463c5ef5a
children 6c1cc07c389d
comparison
equal deleted inserted replaced
10:6572ed4edaae 11:371e14cd2feb
556 OptionsButton:Show() 556 OptionsButton:Show()
557 557
558 --item frame 558 --item frame
559 LibHotCorners:RefereshItems (self) 559 LibHotCorners:RefereshItems (self)
560 560
561 self.AnimOnShow:Play() 561 --self.AnimOnShow:Play()
562 HotCornersInfosFrame:Show() 562 HotCornersInfosFrame:Show()
563 HotCornersInfosFrame:SetAlpha (0) 563 HotCornersInfosFrame:SetAlpha (0)
564 HotCornersInfosFrame.AnimOnShow:Play() 564 --HotCornersInfosFrame.AnimOnShow:Play()
565 565
566 --update repair 566 --update repair
567 local percent, items = 0, 0 567 local percent, items = 0, 0
568 for i = INVSLOT_FIRST_EQUIPPED, INVSLOT_LAST_EQUIPPED do 568 for i = INVSLOT_FIRST_EQUIPPED, INVSLOT_LAST_EQUIPPED do
569 local durability, maxdurability = GetInventoryItemDurability (i) 569 local durability, maxdurability = GetInventoryItemDurability (i)
645 item_button:SetAttribute ("macrotext", "/use " .. GetItemInfo (itemId) .. ";\n/script HotCornersItemUsed=GetTime(); HotCorners:RefereshItems()") 645 item_button:SetAttribute ("macrotext", "/use " .. GetItemInfo (itemId) .. ";\n/script HotCornersItemUsed=GetTime(); HotCorners:RefereshItems()")
646 646
647 item_button.itemtable = itemTable 647 item_button.itemtable = itemTable
648 648
649 if (not item_button:IsShown() or item_button:GetAlpha() < 1) then 649 if (not item_button:IsShown() or item_button:GetAlpha() < 1) then
650 HotCornersStartAnimOnShow (item_button, "item_topleft") 650 -- HotCornersStartAnimOnShow (item_button, "item_topleft")
651 end 651 end
652 end 652 end
653 index = index + 1 653 index = index + 1
654 end 654 end
655 655
729 else 729 else
730 item_button.item_count:SetText (1) 730 item_button.item_count:SetText (1)
731 end 731 end
732 732
733 if (not item_button:IsShown() or item_button:GetAlpha() < 1) then 733 if (not item_button:IsShown() or item_button:GetAlpha() < 1) then
734 HotCornersStartAnimOnShow (item_button, "item_topleft") 734 -- HotCornersStartAnimOnShow (item_button, "item_topleft")
735 end 735 end
736 end 736 end
737 index = index + 1 737 index = index + 1
738 end 738 end
739 end 739 end
761 else 761 else
762 item_button.item_count:SetText (1) 762 item_button.item_count:SetText (1)
763 end 763 end
764 764
765 if (not item_button:IsShown() or item_button:GetAlpha() < 1) then 765 if (not item_button:IsShown() or item_button:GetAlpha() < 1) then
766 HotCornersStartAnimOnShow (item_button, "item_topleft") 766 -- HotCornersStartAnimOnShow (item_button, "item_topleft")
767 end 767 end
768 end 768 end
769 index = index + 1 769 index = index + 1
770 end 770 end
771 end 771 end
912 --> start show animation 912 --> start show animation
913 function HotCornersStartAnimOnShow (button, axis) 913 function HotCornersStartAnimOnShow (button, axis)
914 if (axis == "y") then 914 if (axis == "y") then
915 --button:SetPoint ("topleft", button:GetParent(), "topleft", -32, button.y) 915 --button:SetPoint ("topleft", button:GetParent(), "topleft", -32, button.y)
916 button:SetPoint ("topleft", button:GetParent(), "topleft", 4, button.y) 916 button:SetPoint ("topleft", button:GetParent(), "topleft", 4, button.y)
917 button.AnimOnShow:Play() 917 --button.AnimOnShow:Play()
918 button:Show()
919 button:SetAlpha (1)
918 920
919 elseif (axis == "item_topleft") then 921 elseif (axis == "item_topleft") then
922 --button.AnimOnShow:Play()
920 button:Show() 923 button:Show()
921 button.AnimOnShow:Play() 924 button:SetAlpha (1)
922
923 end 925 end
924 end 926 end
925 927
926 --> on start / finish show animation 928 --> on start / finish show animation
927 function HotCornersAnimOnShowStarted (button) 929 function HotCornersAnimOnShowStarted (button)
970 button_table.widget = button 972 button_table.widget = button
971 973
972 --> set the icon 974 --> set the icon
973 button:SetNormalTexture (button_table.icon) 975 button:SetNormalTexture (button_table.icon)
974 button:SetHighlightTexture (button_table.icon) 976 button:SetHighlightTexture (button_table.icon)
975 977
976 if (string.lower (button_table.icon):find ([[\icons\]])) then 978 if (string.lower (button_table.icon):find ([[\icons\]]) or string.lower (button_table.icon):find ([[\ICONS\]]) or string.lower (button_table.icon):find ([[\Icons\]])) then
977 button:GetNormalTexture():SetTexCoord (0.078125, 0.9375, 0.078125, 0.9375) 979 button:GetNormalTexture():SetTexCoord (0.078125, 0.9375, 0.078125, 0.9375)
978 button:GetHighlightTexture():SetTexCoord (0.078125, 0.9375, 0.078125, 0.9375) 980 button:GetHighlightTexture():SetTexCoord (0.078125, 0.9375, 0.078125, 0.9375)
979 end 981 end
980 982
983 button:SetNormalTexture (button_table.icon)
984 button:SetHighlightTexture (button_table.icon)
985
986 button.Icon = button:CreateTexture (nil, "overlay")
987 button.Icon:SetTexture (button_table.icon)
988 button.Icon:SetSize (32, 32)
989 button.Icon:SetPoint ("center", button, "center", 0, 0)
990
991 --print (button:GetName())
992 --print (1, button:GetAlpha())
993
981 return button 994 return button
982 end 995 end