small editbox improvement

This commit is contained in:
Manuel Simon Hirsig
2016-08-14 23:39:29 +02:00
parent 52b1a551bc
commit 81f84b36a8
+5 -8
View File
@@ -340,16 +340,13 @@ function public.editbox(parent)
editbox:SetScript('OnEditFocusLost', aux._(editbox.HighlightText, aux.this, 0, 0)) editbox:SetScript('OnEditFocusLost', aux._(editbox.HighlightText, aux.this, 0, 0))
editbox:SetScript('OnEscapePressed', aux._(editbox.ClearFocus, aux.this)) editbox:SetScript('OnEscapePressed', aux._(editbox.ClearFocus, aux.this))
do do
local last_time, last_x, last_y local last_click
editbox:SetScript('OnMouseUp', function() editbox:SetScript('OnMouseDown', function()
local x, y = GetCursorPosition() local x, y = GetCursorPosition()
if last_time and GetTime() - last_time < .5 and x == last_x and y == last_y then if last_click and GetTime() - last_click.t < .5 and x == last_click.x and y == last_click.y then
last_time = nil aux.control.thread(function() editbox:HighlightText() end)
this:HighlightText()
else
last_time = GetTime()
last_x, last_y = x, y
end end
last_click = {t=GetTime(), x=x, y=y}
end) end)
end end