mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 18:59:33 +00:00
contrib/InfoPanel: fixed plot resize
git-svn-id: https://svn.fhem.de/fhem/trunk@7834 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
700799a041
commit
49a9ec1008
@ -305,7 +305,7 @@ sub btIP_itemImg {
|
||||
}
|
||||
|
||||
($width,$height,$mimetype,$data) = _btIP_imgData($data,$scale);
|
||||
$output = "<!-- w: $width h: $height t: $mimetype -->\n";
|
||||
$output = "<!-- s: $scale w: $width h: $height t: $mimetype -->\n";
|
||||
$output .= "<image id=\"$id\" x=\"$x\" y=\"$y\" width=\"".$width."px\" height=\"".$height."px\" \nxlink:href=\"$data\" />\n";
|
||||
return $output;
|
||||
}
|
||||
@ -337,15 +337,6 @@ sub _btIP_imgRescale {
|
||||
return ($width,$height);
|
||||
}
|
||||
|
||||
sub _btIP_svgRescale {
|
||||
my ($width,$height,$scale) = @_;
|
||||
if ($scale =~ s/([whWH])([\d]*)/$2/) {
|
||||
$scale = (uc($1) eq "W") ? $scale/$width : $scale/$height;
|
||||
}
|
||||
return $scale;
|
||||
}
|
||||
|
||||
|
||||
sub btIP_itemLine {
|
||||
my ($id,$x1,$y1,$x2,$y2,$th,%params)= @_;
|
||||
$id = ($id eq '-') ? createUniqueId() : $id;
|
||||
@ -357,7 +348,7 @@ sub btIP_itemPlot {
|
||||
my ($id,$x,$y,$scale,$inline,$arg) = @_;
|
||||
my (@plotName) = split(";",$arg);
|
||||
$id = ($id eq '-') ? createUniqueId() : $id;
|
||||
my (@webs,$width,$height,$output,$mimetype,$svgdata);
|
||||
my (@webs,$width,$height,$newWidth,$newHeight,$output,$mimetype,$svgdata);
|
||||
|
||||
@webs=devspec2array("TYPE=FHEMWEB");
|
||||
foreach(@webs) {
|
||||
@ -368,48 +359,26 @@ sub btIP_itemPlot {
|
||||
}
|
||||
|
||||
($width,$height) = split(",", AttrVal($plotName[0],"plotsize","800,160"));
|
||||
($width,$height) = _btIP_imgRescale($width,$height,$scale) unless $scale eq '1';
|
||||
($newWidth,$newHeight) = _btIP_imgRescale($width,$height,$scale);
|
||||
$attr{$plotName[0]}{plotsize} = "$newWidth,$newHeight";
|
||||
|
||||
if($inline eq "1") {
|
||||
#
|
||||
# embed base64 data
|
||||
#
|
||||
$FW_RET = undef;
|
||||
$FW_webArgs{dev} = $plotName[0];
|
||||
$FW_webArgs{logdev} = InternalVal($plotName[0], "LOGDEVICE", "");
|
||||
$FW_webArgs{gplotfile} = InternalVal($plotName[0], "GPLOTFILE", "");
|
||||
$FW_webArgs{logfile} = InternalVal($plotName[0], "LOGFILE", "CURRENT");
|
||||
$FW_pos{zoom} = ($plotName[1]) ? $plotName[1] : 'day';
|
||||
$FW_pos{off} = ($plotName[2]) ? $plotName[2] : undef;
|
||||
$FW_RET = undef;
|
||||
$FW_webArgs{dev} = $plotName[0];
|
||||
$FW_webArgs{logdev} = InternalVal($plotName[0], "LOGDEVICE", "");
|
||||
$FW_webArgs{gplotfile} = InternalVal($plotName[0], "GPLOTFILE", "");
|
||||
$FW_webArgs{logfile} = InternalVal($plotName[0], "LOGFILE", "CURRENT");
|
||||
$FW_pos{zoom} = ($plotName[1]) ? $plotName[1] : 'day';
|
||||
$FW_pos{off} = ($plotName[2]) ? $plotName[2] : undef;
|
||||
|
||||
($mimetype, $svgdata) = SVG_showLog("unused");
|
||||
$svgdata =~ s/<\/svg>/<polyline opacity="0" points="0,0 $width,$height"\/><\/svg>/;
|
||||
($mimetype, $svgdata) = SVG_showLog("unused");
|
||||
$attr{$plotName[0]}{plotsize} = "$width,$height";
|
||||
|
||||
($width,$height,$mimetype,$svgdata) = _btIP_imgData($svgdata,1);
|
||||
$scale = _btIP_svgRescale($width,$height,$scale);
|
||||
$svgdata =~ s/<\/svg>/<polyline opacity="0" points="0,0 $width,$height"\/><\/svg>/;
|
||||
(undef,undef,undef,$svgdata) = _btIP_imgData($svgdata,1);
|
||||
|
||||
$output = "<!-- w: $width h: $height t: $mimetype -->\n";
|
||||
# $output .= "<image id=\"$id\" x=\"$x\" y=\"$y\" width=\"".$width."px\" height=\"".$height."px\" \n";
|
||||
# $output .= "xlink:href=\"$svgdata\" />\n";
|
||||
|
||||
$output .= "<defs><symbol id=\"sym_$id\">\n".
|
||||
"<image id=\"$id\" x=\"$x\" y=\"$y\" width=\"".$width."px\" height=\"".$height."px\" ".
|
||||
"xlink:href=\"$svgdata\" />\n</symbol></defs>\n".
|
||||
"<use xlink:href=\"#sym_$id\" x=\"$x\" y=\"$y\" transform=\"scale($scale)\" />\n";
|
||||
} else {
|
||||
#
|
||||
# embed link to plot
|
||||
#
|
||||
my $url;
|
||||
$url = "$FW_ME/SVG_showLog?dev=". $plotName[0].
|
||||
"&logdev=". InternalVal($plotName[0], "LOGDEVICE", "").
|
||||
"&gplotfile=". InternalVal($plotName[0], "GPLOTFILE", "").
|
||||
"&logfile=". InternalVal($plotName[0], "LOGFILE", "CURRENT");
|
||||
$url .= "&pos=". ($plotName[1]) ? $plotName[1] : 'day';
|
||||
$url .= "&zoom=". ($plotName[2]) ? $plotName[2] : undef;
|
||||
|
||||
$output = "<image id=\"$id\" x=\"$x\" y=\"$y\" width=\"".$width."px\" height=\"".$height."px\" \nxlink:href=\"$url\" />\n";
|
||||
}
|
||||
$output = "<!-- w: $width h: $height nw: $newWidth nh: $newHeight t: $mimetype -->\n";
|
||||
$output .= "<image id=\"$id\" x=\"$x\" y=\"$y\" width=\"${newWidth}px\" height=\"${newHeight}px\" \n";
|
||||
$output .= "xlink:href=\"$svgdata\" />\n";
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user