Fix opacity calculation on chrome
This commit is contained in:
parent
e4e0f56be0
commit
6b50de5e35
2 changed files with 8 additions and 2 deletions
|
@ -102,8 +102,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if m %}
|
{% if m %}
|
||||||
<td class="{% if m.sum > 0 %}p{% else %}m{% endif %}"
|
<td class="{% if m.sum > 0 %}p{% else %}m{% endif %}"
|
||||||
style="opacity: calc( sin( abs({% widthratio m.sum history.years_max 100 %}) / 400 * 1turn ) )">
|
style="opacity: {% opacity m.sum history.years_max %}"></td>
|
||||||
</td>
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<td></td>
|
<td></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import math
|
||||||
|
|
||||||
from django import template
|
from django import template
|
||||||
from django.templatetags.static import static
|
from django.templatetags.static import static
|
||||||
from django.utils import formats
|
from django.utils import formats
|
||||||
|
@ -67,3 +69,8 @@ def css(href):
|
||||||
return mark_safe(
|
return mark_safe(
|
||||||
f"""<link rel="stylesheet" href="{static(href)}" type="text/css">"""
|
f"""<link rel="stylesheet" href="{static(href)}" type="text/css">"""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@register.simple_tag
|
||||||
|
def opacity(v, vmax):
|
||||||
|
return f"{math.sin(math.fabs(v/vmax)*math.pi/2):.2f}"
|
||||||
|
|
Loading…
Reference in a new issue