mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
console.lua: deduplicate y position calculation in update()
This deduplicates the calculation of the y position by assigning it to a y variable, which will also be used in the next commit. margin_x is also renamed to x for consistency.
This commit is contained in:
@@ -547,8 +547,8 @@ local function update()
|
||||
|
||||
local osd_w, osd_h = get_scaled_osd_dimensions()
|
||||
|
||||
local margin_x = get_margin_x()
|
||||
local margin_y = get_margin_y()
|
||||
local x = get_margin_x()
|
||||
local y = osd_h * (1 - global_margins.b) - get_margin_y()
|
||||
|
||||
local coordinate_top = math.floor(global_margins.t * osd_h + 0.5)
|
||||
local clipping_coordinates = '0,' .. coordinate_top .. ',' ..
|
||||
@@ -589,7 +589,7 @@ local function update()
|
||||
-- libass/ass_render.c:ass_render_event() subtracts --osd-margin-x from
|
||||
-- the maximum text width twice.
|
||||
local width_max = math.floor(
|
||||
(osd_w - margin_x - mp.get_property_native('osd-margin-x') * 2 / scale_factor())
|
||||
(osd_w - x - mp.get_property_native('osd-margin-x') * 2 / scale_factor())
|
||||
/ opts.font_size * get_font_hw_ratio())
|
||||
|
||||
local suggestions, rows = format_table(suggestion_buffer, width_max, max_lines)
|
||||
@@ -608,7 +608,7 @@ local function update()
|
||||
|
||||
ass:new_event()
|
||||
ass:an(1)
|
||||
ass:pos(margin_x, osd_h - margin_y - global_margins.b * osd_h)
|
||||
ass:pos(x, y)
|
||||
ass:append(log_ass .. '\\N')
|
||||
ass:append(suggestion_ass)
|
||||
ass:append(style .. ass_escape(prompt) .. ' ' .. before_cur)
|
||||
@@ -619,7 +619,7 @@ local function update()
|
||||
-- cursor appear in front of the text.
|
||||
ass:new_event()
|
||||
ass:an(1)
|
||||
ass:pos(margin_x, osd_h - margin_y - global_margins.b * osd_h)
|
||||
ass:pos(x, y)
|
||||
ass:append(style .. '{\\alpha&HFF&}' .. ass_escape(prompt) .. ' ' .. before_cur)
|
||||
ass:append(cglyph)
|
||||
ass:append(style .. '{\\alpha&HFF&}' .. after_cur)
|
||||
|
||||
Reference in New Issue
Block a user