From 57af5687dda1947f8d5fb040c702566215a73168 Mon Sep 17 00:00:00 2001 From: Damian <> Date: Sat, 20 Mar 2021 09:15:41 +0000 Subject: [PATCH] 98_DOIF.pm: svg bar functions: position improvements git-svn-id: https://svn.fhem.de/fhem/trunk@24019 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/98_DOIF.pm | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/fhem/FHEM/98_DOIF.pm b/fhem/FHEM/98_DOIF.pm index 7ce44bfbe..284e2eb23 100644 --- a/fhem/FHEM/98_DOIF.pm +++ b/fhem/FHEM/98_DOIF.pm @@ -4331,7 +4331,7 @@ sub bar $unit="" if (!defined $unit); if (!defined $bheight) { if (defined ($icon)) { - $bheight=80; + $bheight=75; } else { $bheight=60; } @@ -4352,7 +4352,8 @@ sub bar $dec=1 if (!defined $dec); - $ypos=int(($height-44)/3+10); + + $ypos= (defined ($icon) and $bheight >= 75) ? int($height/2-3):int($height/2+3); ($format,$value,$val)=format_value($val,$min,$dec); @@ -4397,9 +4398,9 @@ sub bar $ix=$bwidth/2+3; }; if (defined ($iy)) { - $iy+=$ypos; + $iy+=($ypos-14); } else { - $iy=$ypos; + $iy=($ypos-14); }; $rotate=0 if (!defined $rotate); $iscale=1 if (!defined $iscale); @@ -4458,27 +4459,27 @@ sub bar my ($valInt,$valDec)=split(/\./,sprintf($format,$val)); - if ($bheight>=80 or !defined ($icon) and $bheight >= 50) { + if ($bheight>=75 or !defined ($icon) and $bheight >= 50) { if (defined $valDec) { $out.= sprintf('%s.%s', - $bwidth/2+15,(defined ($icon) ? $ypos+38:$ypos+20),color($currColor,$ln),$fontformat,$valInt,$valDec); + $bwidth/2+15,(defined ($icon) ? $ypos+23:$ypos+5),color($currColor,$ln),$fontformat,$valInt,$valDec); $out.= sprintf('%s', - $bwidth/2+15,(defined ($icon) ? $ypos+49:$ypos+31),color($currColor,$ln),$unitformat,$unit); + $bwidth/2+15,(defined ($icon) ? $ypos+34:$ypos+16),color($currColor,$ln),$unitformat,$unit); } else { $out.= sprintf('%s', - $bwidth/2+15,(defined ($icon) ? $ypos+38:$ypos+20),color($currColor,$ln),$fontformat,$valInt); + $bwidth/2+15,(defined ($icon) ? $ypos+23:$ypos+5),color($currColor,$ln),$fontformat,$valInt); $out.= sprintf('%s', - $bwidth/2+15,(defined ($icon) ? $ypos+49:$ypos+31),color($currColor,$ln),$unitformat,$unit); + $bwidth/2+15,(defined ($icon) ? $ypos+34:$ypos+16),color($currColor,$ln),$unitformat,$unit); } } else { if (defined $valDec) { - $out.= sprintf('%s.%s%s', - $bwidth+6,(defined ($icon) ? $height/2+25:$height/2+12),color($currColor,$ln),$fontformat,$valInt,$valDec,$unitformat,$unit); + $out.= sprintf('%s.%s%s', + $bwidth/2+15,(defined ($icon) ? $height/2+25:$height/2+12),color($currColor,$ln),$fontformat,$valInt,$valDec,$unitformat,$unit); } else { - $out.= sprintf('%s%s', - $bwidth+6,(defined ($icon) ? $height/2+25:$height/2+12),color($currColor,$ln),$fontformat,$valInt,$unitformat,$unit); + $out.= sprintf('%s%s', + $bwidth/2+15,(defined ($icon) ? $height/2+25:$height/2+12),color($currColor,$ln),$fontformat,$valInt,$unitformat,$unit); } }