initial commit

This commit is contained in:
airstruck
2015-10-21 18:35:14 -04:00
commit e490e2899f
52 changed files with 1506 additions and 0 deletions

35
luigi/widget/sash.lua Normal file
View File

@@ -0,0 +1,35 @@
local Widget = require((...):gsub('%.[^.]*$', ''))
local Sash = Widget:extend()
function Sash:constructor(layout, data)
Widget.constructor(self, layout, data)
self:onPressDrag(function(event)
local axis = self.parent.flow
if axis == 'x' then
dimension = 'width'
else
axis = 'y'
dimension = 'height'
end
local prevSibling = self:getPrevious()
local nextSibling = self:getNext()
local prevSize = prevSibling and prevSibling[dimension]
local nextSize = nextSibling and nextSibling[dimension]
if prevSize then
prevSibling:setDimension(dimension,
event[axis] - prevSibling:calculatePosition(axis))
end
if nextSize then
nextSibling:setDimension(dimension,
nextSibling:calculatePosition(axis) +
nextSibling[dimension] - event[axis])
end
layout:update(true)
end)
end
return Sash