REF move dial to common

This commit is contained in:
Nathan Dwarshuis 2021-07-11 23:02:45 -04:00
parent 5d3c4374bc
commit abe27ad148
2 changed files with 18 additions and 13 deletions

View File

@ -2,6 +2,8 @@ local M = {}
local Util = require 'Util' local Util = require 'Util'
local Arc = require 'Arc' local Arc = require 'Arc'
local Dial = require 'Dial'
local CompoundDial = require 'CompoundDial'
local Text = require 'Text' local Text = require 'Text'
local CriticalText = require 'CriticalText' local CriticalText = require 'CriticalText'
local TextColumn = require 'TextColumn' local TextColumn = require 'TextColumn'
@ -277,8 +279,22 @@ M.text_ring_set = function(tr, cr, value)
end end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- separator (eg a horizontal line) -- dial
M.dial = function(x, y, radius, thickness, threshold)
return _G_Widget_.Dial(
_G_Widget_.make_semicircle(x, y, radius, 90, 360),
_G_Widget_.arc_style(thickness, _G_Patterns_.INDICATOR_BG),
_G_Widget_.threshold_style(
_G_Patterns_.INDICATOR_FG_PRIMARY,
_G_Patterns_.INDICATOR_FG_CRITICAL,
threshold
)
)
end
--------------------------------------------------------------------------------
-- separator (eg a horizontal line)
M.initSeparator = function(x, y, w) M.initSeparator = function(x, y, w)
return _G_Widget_.Line( return _G_Widget_.Line(

View File

@ -54,18 +54,7 @@ local DIAL_THETA_1 = math.rad(360)
local DIAL_X = _G_INIT_DATA_.RIGHT_X + DIAL_RADIUS + _DIAL_THICKNESS_ / 2 local DIAL_X = _G_INIT_DATA_.RIGHT_X + DIAL_RADIUS + _DIAL_THICKNESS_ / 2
local DIAL_Y = header.bottom_y + DIAL_RADIUS + _DIAL_THICKNESS_ / 2 local DIAL_Y = header.bottom_y + DIAL_RADIUS + _DIAL_THICKNESS_ / 2
local dial = _G_Widget_.Dial( local dial = Common.dial(DIAL_X, DIAL_Y, DIAL_RADIUS, _DIAL_THICKNESS_, 0.8)
_G_Widget_.make_semicircle(DIAL_X, DIAL_Y, DIAL_RADIUS, 90, 360),
_G_Widget_.arc_style(
_DIAL_THICKNESS_,
_G_Patterns_.INDICATOR_BG
),
_G_Widget_.threshold_style(
_G_Patterns_.INDICATOR_FG_PRIMARY,
_G_Patterns_.INDICATOR_FG_CRITICAL,
0.8
)
)
local cache_arc = _G_Widget_.Arc( local cache_arc = _G_Widget_.Arc(
_G_Widget_.make_semicircle(DIAL_X, DIAL_Y, DIAL_RADIUS, 90, 360), _G_Widget_.make_semicircle(DIAL_X, DIAL_Y, DIAL_RADIUS, 90, 360),
_G_Widget_.arc_style( _G_Widget_.arc_style(