changeset 19:215f0dd37a6c

library update.
author Tercio
date Sat, 18 Jul 2015 17:32:30 -0300
parents 680465749fc7
children dc1c77254f80
files Libs/DF/button.lua Libs/DF/panel.lua
diffstat 2 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Libs/DF/button.lua	Fri Jun 26 14:03:10 2015 -0300
+++ b/Libs/DF/button.lua	Sat Jul 18 17:32:30 2015 -0300
@@ -988,11 +988,13 @@
 end
 
 local pickcolor_callback = function (self, r, g, b, a, button)
+	a = abs (a-1)
 	button.MyObject.color_texture:SetVertexColor (r, g, b, a)
 	button.MyObject:color_callback (r, g, b, a)
 end
-local pickcolor = function (alpha, param2, self)
+local pickcolor = function (self, alpha, param2)
 	local r, g, b, a = self.MyObject.color_texture:GetVertexColor()
+	a = abs (a-1)
 	DF:ColorPick (self, r, g, b, a, pickcolor_callback)
 end
 
@@ -1000,6 +1002,7 @@
 local color_button_width = 16
 
 local set_colorpick_color = function (button, r, g, b, a)
+	a = a or 1
 	button.color_texture:SetVertexColor (r, g, b, a)
 end
 
--- a/Libs/DF/panel.lua	Fri Jun 26 14:03:10 2015 -0300
+++ b/Libs/DF/panel.lua	Sat Jul 18 17:32:30 2015 -0300
@@ -1330,6 +1330,8 @@
 		db.IsLocked = db.IsLocked or false
 		self.IsLocked = db.IsLocked
 		db.position = db.position or {x = 0, y = 0}
+		db.position.x = db.position.x or 0
+		db.position.y = db.position.y or 0
 		DF:RestoreFramePosition (self)
 	end
 end
@@ -1338,7 +1340,9 @@
 	if (frame.db and frame.db.position) then
 		local x, y = DF:GetPositionOnScreen (frame)
 		--print ("saving...", x, y, frame:GetName())
-		frame.db.position.x, frame.db.position.y = x, y
+		if (x and y) then
+			frame.db.position.x, frame.db.position.y = x, y
+		end
 	end
 end
 
@@ -1358,6 +1362,8 @@
 	if (frame.db and frame.db.position) then
 		local scale, UIscale = frame:GetEffectiveScale(), UIParent:GetScale()
 		frame:ClearAllPoints()
+		frame.db.position.x = frame.db.position.x or 0
+		frame.db.position.y = frame.db.position.y or 0
 		frame:SetPoint ("center", UIParent, "center", frame.db.position.x * UIscale / scale, frame.db.position.y * UIscale / scale)
 	end
 end