contextmenu: make divider less aggressive (#1228)
Following changes are applied: - use divider color instead of caret; - add a vertical padding on the divider.
This commit is contained in:
parent
5ab8dc0275
commit
5b5b5fd3e3
|
@ -9,6 +9,7 @@ local View = require "core.view"
|
||||||
|
|
||||||
local border_width = 1
|
local border_width = 1
|
||||||
local divider_width = 1
|
local divider_width = 1
|
||||||
|
local divider_padding = 5
|
||||||
local DIVIDER = {}
|
local DIVIDER = {}
|
||||||
|
|
||||||
---@class core.contextmenu : core.object
|
---@class core.contextmenu : core.object
|
||||||
|
@ -29,7 +30,7 @@ local function get_item_size(item)
|
||||||
local lw, lh
|
local lw, lh
|
||||||
if item == DIVIDER then
|
if item == DIVIDER then
|
||||||
lw = 0
|
lw = 0
|
||||||
lh = divider_width
|
lh = divider_width + divider_padding * SCALE * 2
|
||||||
else
|
else
|
||||||
lw = style.font:get_width(item.text)
|
lw = style.font:get_width(item.text)
|
||||||
if item.info then
|
if item.info then
|
||||||
|
@ -224,7 +225,7 @@ function ContextMenu:draw_context_menu()
|
||||||
|
|
||||||
for i, item, x, y, w, h in self:each_item() do
|
for i, item, x, y, w, h in self:each_item() do
|
||||||
if item == DIVIDER then
|
if item == DIVIDER then
|
||||||
renderer.draw_rect(x, y, w, h, style.caret)
|
renderer.draw_rect(x, y + divider_padding * SCALE, w, divider_width, style.divider)
|
||||||
else
|
else
|
||||||
if i == self.selected then
|
if i == self.selected then
|
||||||
renderer.draw_rect(x, y, w, h, style.selection)
|
renderer.draw_rect(x, y, w, h, style.selection)
|
||||||
|
|
Loading…
Reference in New Issue