Clock widget: render sharp on retina (support devicePixelRatio)
This commit is contained in:
parent
74e1fa8722
commit
6f67f417ee
2 changed files with 8 additions and 2 deletions
|
@ -28,14 +28,18 @@ class Stats extends App.Controller
|
||||||
@renderWidgetClockFace(data.StatsTicketWaitingTime.handling_time, data.StatsTicketWaitingTime.state, data.StatsTicketWaitingTime.percent)
|
@renderWidgetClockFace(data.StatsTicketWaitingTime.handling_time, data.StatsTicketWaitingTime.state, data.StatsTicketWaitingTime.percent)
|
||||||
|
|
||||||
renderWidgetClockFace: (time, state, percent) =>
|
renderWidgetClockFace: (time, state, percent) =>
|
||||||
|
dpr = window.devicePixelRatio || 1
|
||||||
canvas = @el.find 'canvas'
|
canvas = @el.find 'canvas'
|
||||||
ctx = canvas.get(0).getContext '2d'
|
ctx = canvas.get(0).getContext '2d'
|
||||||
radius = 26
|
radius = 26
|
||||||
|
|
||||||
@el.find('.time.stat-widget .stat-amount').text time
|
@el.find('.time.stat-widget .stat-amount').text time
|
||||||
|
|
||||||
canvas.attr 'width', 2 * radius
|
canvas.attr 'width', 2 * radius * dpr
|
||||||
canvas.attr 'height', 2 * radius
|
canvas.attr 'height', 2 * radius * dpr
|
||||||
|
|
||||||
|
# scale canvas to dpr (2x on retina)
|
||||||
|
ctx.scale dpr, dpr
|
||||||
|
|
||||||
handlingTimeColors = {}
|
handlingTimeColors = {}
|
||||||
handlingTimeColors['supergood'] = '#38AE6A' # supergood
|
handlingTimeColors['supergood'] = '#38AE6A' # supergood
|
||||||
|
|
|
@ -4424,6 +4424,8 @@ footer {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 21px;
|
top: 21px;
|
||||||
left: 14px;
|
left: 14px;
|
||||||
|
width: 52px;
|
||||||
|
height: 52px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stats-row {
|
.stats-row {
|
||||||
|
|
Loading…
Reference in a new issue