mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 04:36:36 +00:00
svg.js: Implement the pathSegList interface (Forum #49085)
git-svn-id: https://svn.fhem.de/fhem/trunk@10792 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
6b9b7a43ae
commit
f7441ab85b
@ -1907,7 +1907,7 @@ SVG_render($$$$$$$$$$)
|
||||
my @tvals = split("[ ,]", $ret);
|
||||
if (@tvals > 2) {
|
||||
if ($tvals[0] ne "M") { # just points, no M/L
|
||||
$ret = sprintf("M %d %d $lt $ret", $tvals[1],$tvals[2]);
|
||||
$ret = sprintf("M %d,%d $lt $ret", $tvals[1],$tvals[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2054,7 +2054,7 @@ SVG_getControlPoints($)
|
||||
my $header = "";
|
||||
|
||||
foreach my $i (0..int(@vals)-1) {
|
||||
$header .= $vals[$i] . " ";
|
||||
$header .= $vals[$i] . ($i == 1 ? "," : " ");
|
||||
if ($vals[$i] eq "C" || $vals[$i] eq "Q") {
|
||||
my $lt = $vals[$i];
|
||||
$i++;
|
||||
|
@ -198,6 +198,22 @@ sv_menu(evt, embed)
|
||||
$("#content").append(par.div);
|
||||
|
||||
var pl = selNode[arrName];
|
||||
if(!pl) { // chrome 48+ removed the pathSegList interface
|
||||
function
|
||||
myPathSegList(node)
|
||||
{
|
||||
this.arr = $(node).attr("d").split(/ */);
|
||||
this.arr.splice(0,1); // remove M
|
||||
this.arr.splice(1,1); // remove L/Q/etc
|
||||
this.numberOfItems = this.arr.length;
|
||||
this.getItem = function(pos)
|
||||
{
|
||||
var xy = this.arr[pos].split(",");
|
||||
return { x:parseFloat(xy[0]), y:parseFloat(xy[1]) };
|
||||
}
|
||||
}
|
||||
selNode[arrName] = pl = new myPathSegList(selNode);
|
||||
}
|
||||
if(pl.numberOfItems > 2)
|
||||
mousemove({pageX:pl.getItem(pl.numberOfItems-2).x});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user