mirror of
https://github.com/airstruck/luigi.git
synced 2026-01-10 08:18:22 +00:00
minor
This commit is contained in:
@@ -29,7 +29,7 @@ local style = {
|
|||||||
padding = 8,
|
padding = 8,
|
||||||
background = { 255, 255, 255 },
|
background = { 255, 255, 255 },
|
||||||
icon = 'icon/32px/Box.png',
|
icon = 'icon/32px/Box.png',
|
||||||
multiline = true,
|
wrap = true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,7 +177,7 @@ eight
|
|||||||
|
|
||||||
layout.mainCanvas.align = 'top'
|
layout.mainCanvas.align = 'top'
|
||||||
|
|
||||||
layout.mainCanvas.multiline = true
|
layout.mainCanvas.wrap = true
|
||||||
|
|
||||||
local Backend = require 'luigi.backend'
|
local Backend = require 'luigi.backend'
|
||||||
|
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ function Renderer:positionText (widget, x1, y1, x2, y2)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not widget.textData then
|
if not widget.textData then
|
||||||
local limit = widget.multiline and x2 - x1 or nil
|
local limit = widget.wrap and x2 - x1 or nil
|
||||||
widget.textData = Text(
|
widget.textData = Text(
|
||||||
font, widget.text, widget.textColor, horizontal, limit)
|
font, widget.text, widget.textColor, horizontal, limit)
|
||||||
end
|
end
|
||||||
@@ -230,9 +230,9 @@ function Renderer:renderIconAndText (widget)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- horizontal alignment for non-multiline
|
-- horizontal alignment for non-wrapped text
|
||||||
-- TODO: handle this in Backend.Text
|
-- TODO: handle this in Backend.Text
|
||||||
if text and not widget.multiline then
|
if text and not widget.wrap then
|
||||||
if align:find 'right' then
|
if align:find 'right' then
|
||||||
textX = textX + ((x2 - x1) - widget.textData:getWidth())
|
textX = textX + ((x2 - x1) - widget.textData:getWidth())
|
||||||
elseif align:find 'center' then
|
elseif align:find 'center' then
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ local function metaNewIndex (self, property, value)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if property == 'text' or property == 'textColor'
|
if property == 'text' or property == 'textColor'
|
||||||
or property == 'align' or property == 'multiline' then
|
or property == 'align' or property == 'wrap' then
|
||||||
self.shadowProperties[property] = value
|
self.shadowProperties[property] = value
|
||||||
self.textData = nil
|
self.textData = nil
|
||||||
return
|
return
|
||||||
@@ -66,7 +66,7 @@ local function metaNewIndex (self, property, value)
|
|||||||
if property == 'width' then
|
if property == 'width' then
|
||||||
value = value and math.max(value, self.minwidth or 0)
|
value = value and math.max(value, self.minwidth or 0)
|
||||||
self.shadowProperties[property] = value
|
self.shadowProperties[property] = value
|
||||||
if self.multiline then
|
if self.wrap then
|
||||||
self.textData = nil
|
self.textData = nil
|
||||||
end
|
end
|
||||||
Widget.reshape(self.parent or self)
|
Widget.reshape(self.parent or self)
|
||||||
@@ -126,7 +126,7 @@ local shadowKeys = {
|
|||||||
'width', 'height',
|
'width', 'height',
|
||||||
'font', 'fontSize',
|
'font', 'fontSize',
|
||||||
'text', 'textColor',
|
'text', 'textColor',
|
||||||
'align', 'multiline',
|
'align', 'wrap',
|
||||||
}
|
}
|
||||||
|
|
||||||
--[[--
|
--[[--
|
||||||
|
|||||||
Reference in New Issue
Block a user