adjust font sizes in response to zoom changes
This commit is contained in:
parent
e2724a839d
commit
ce8fa29abd
|
@ -65,6 +65,9 @@ function car.touch_move(id, x,y, ...)
|
|||
local c = centroid(curr[f], curr[s])
|
||||
v.x = v.x + c.x/oldzoom - c.x/v.zoom
|
||||
v.y = v.y + c.y/oldzoom - c.y/v.zoom
|
||||
for _,w in ipairs(widgets) do
|
||||
if w.refresh_font then w.refresh_font() end
|
||||
end
|
||||
end end end
|
||||
|
||||
function car.mouse_release(x,y, b)
|
||||
|
|
|
@ -120,14 +120,17 @@ function add_editor()
|
|||
table.insert(widgets, adjh)
|
||||
|
||||
-- font buttons
|
||||
local update_font = function(newf)
|
||||
if font_height == newf then return end
|
||||
font_height = newf
|
||||
r.refresh_font = function()
|
||||
e.font_height = scale(font_height)
|
||||
e.font = g.newFont(e.font_height)
|
||||
e.line_height = floor(e.font_height)*1.3
|
||||
Text.redraw_all(e)
|
||||
end
|
||||
local update_font = function(newf)
|
||||
if font_height == newf then return end
|
||||
font_height = newf
|
||||
r.refresh_font()
|
||||
end
|
||||
table.insert(widgets, {
|
||||
draw = function()
|
||||
color(0.7,0.7,0.7)
|
||||
|
|
Loading…
Reference in New Issue