Fix Issue 473: WebKit browsers fixed for navigation, caused by r1368
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1376 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
5ce59294d1
commit
507e50767f
|
@ -1992,22 +1992,24 @@ function BatchCommand(text) {
|
|||
m = svgroot.createSVGMatrix();
|
||||
|
||||
// temporarily strip off the rotate and save the old center
|
||||
var gangle = canvas.getRotationAngle(selected);
|
||||
if (gangle) {
|
||||
var a = gangle * Math.PI / 180;
|
||||
if ( Math.abs(a) > (1.0e-10) ) {
|
||||
var s = Math.sin(a)/(1 - Math.cos(a));
|
||||
} else {
|
||||
// FIXME: This blows up if the angle is exactly 0!
|
||||
var s = 2/a;
|
||||
}
|
||||
for (var i = 0; i < tlist.numberOfItems; ++i) {
|
||||
var xform = tlist.getItem(i);
|
||||
if (xform.type == 4) {
|
||||
// extract old center through mystical arts
|
||||
var rm = xform.matrix;
|
||||
var a = gangle * Math.PI / 180;
|
||||
// FIXME: This blows up if the angle is exactly 0 or 180 degrees!
|
||||
oldcenter.y = 0.5 * (Math.sin(a)*rm.e + (1-Math.cos(a))*rm.f) / (1 - Math.cos(a));
|
||||
oldcenter.x = ((1 - Math.cos(a)) * oldcenter.y - rm.f) / Math.sin(a);
|
||||
oldcenter.y = (s*rm.e + rm.f)/2;
|
||||
oldcenter.x = (rm.e - s*rm.f)/2;
|
||||
tlist.removeItem(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var tx = 0, ty = 0,
|
||||
operation = 0,
|
||||
|
@ -2223,21 +2225,25 @@ function BatchCommand(text) {
|
|||
m = svgroot.createSVGMatrix(),
|
||||
// temporarily strip off the rotate and save the old center
|
||||
angle = canvas.getRotationAngle(selected);
|
||||
if (angle) {
|
||||
|
||||
var a = angle * Math.PI / 180;
|
||||
if ( Math.abs(a) > (1.0e-10) ) {
|
||||
var s = Math.sin(a)/(1 - Math.cos(a));
|
||||
} else {
|
||||
// FIXME: This blows up if the angle is exactly 0!
|
||||
var s = 2/a;
|
||||
}
|
||||
for (var i = 0; i < tlist.numberOfItems; ++i) {
|
||||
var xform = tlist.getItem(i);
|
||||
if (xform.type == 4) {
|
||||
// extract old center through mystical arts
|
||||
var rm = xform.matrix;
|
||||
var a = angle * Math.PI / 180;
|
||||
// FIXME: This blows up if the angle is exactly 0 or 180 degrees!
|
||||
oldcenter.y = 0.5 * (Math.sin(a)*rm.e + (1-Math.cos(a))*rm.f) / (1 - Math.cos(a));
|
||||
oldcenter.x = ((1 - Math.cos(a)) * oldcenter.y - rm.f) / Math.sin(a);
|
||||
oldcenter.y = (s*rm.e + rm.f)/2;
|
||||
oldcenter.x = (rm.e - s*rm.f)/2;
|
||||
tlist.removeItem(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 2 = translate, 3 = scale, 4 = rotate, 1 = matrix imposition
|
||||
var operation = 0;
|
||||
|
@ -2730,7 +2736,11 @@ function BatchCommand(text) {
|
|||
mouse_target = mouse_target.correspondingUseElement;
|
||||
|
||||
// for foreign content, go up until we find the foreignObject
|
||||
if ($.inArray(mouse_target.namespaceURI, [mathns, htmlns]) != -1) {
|
||||
// WebKit browsers set the mouse target to the svgcanvas div
|
||||
if ($.inArray(mouse_target.namespaceURI, [mathns, htmlns]) != -1 &&
|
||||
mouse_target.id != "svgcanvas")
|
||||
{
|
||||
console.log(mouse_target.id);
|
||||
while (mouse_target.nodeName != "foreignObject") {
|
||||
mouse_target = mouse_target.parentNode;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue