Merge branch 'master' into ellipse_preserve_0_rx_ry

This commit is contained in:
Magne Bratseth
2016-02-25 08:50:37 +01:00
4 changed files with 157 additions and 36 deletions

View File

@@ -59,7 +59,7 @@ var supportsPathReplaceItem_ = (function() {
var seglist = path.pathSegList;
var seg = path.createSVGPathSegLinetoAbs(5,5);
try {
seglist.replaceItem(seg, 0);
seglist.replaceItem(seg, 1);
return true;
} catch(err) {}
return false;
@@ -71,7 +71,7 @@ var supportsPathInsertItemBefore_ = (function() {
var seglist = path.pathSegList;
var seg = path.createSVGPathSegLinetoAbs(5,5);
try {
seglist.insertItemBefore(seg, 0);
seglist.insertItemBefore(seg, 1);
return true;
} catch(err) {}
return false;

View File

@@ -478,16 +478,12 @@ svgedit.path.Segment.prototype.update = function(full) {
svgedit.path.Segment.prototype.move = function(dx, dy) {
var cur_pts, item = this.item;
// fix for path tool dom breakage, amending item does bad things now, so we take a copy and use that. Can probably improve to just take a shallow copy of object
var cloneItem = $.extend({}, item);
if (this.ctrlpts) {
cur_pts = [cloneItem.x += dx, cloneItem.y += dy,
cloneItem.x1, cloneItem.y1, cloneItem.x2 += dx, cloneItem.y2 += dy];
} else {
cur_pts = [cloneItem.x += dx, cloneItem.y += dy];
}
//fix
if (this.ctrlpts) {
cur_pts = [item.x += dx, item.y += dy,
item.x1, item.y1, item.x2 += dx, item.y2 += dy];
} else {
cur_pts = [item.x += dx, item.y += dy];
}
svgedit.path.replacePathSeg(this.type, this.index, cur_pts);
@@ -526,16 +522,12 @@ svgedit.path.Segment.prototype.setLinked = function(num) {
}
var item = seg.item;
// fix for path tool dom breakage, amending item does bad things now, so we take a copy and use that. Can probably improve to just take a shallow copy of object
var cloneItem = $.extend({}, item);
cloneItem['x' + anum ] = pt.x + (pt.x - this.item['x' + num]);
cloneItem['y' + anum ] = pt.y + (pt.y - this.item['y' + num]);
var pts = [cloneItem.x, cloneItem.y,
cloneItem.x1, cloneItem.y1,
cloneItem.x2, cloneItem.y2];
//end fix
item['x' + anum ] = pt.x + (pt.x - this.item['x' + num]);
item['y' + anum ] = pt.y + (pt.y - this.item['y' + num]);
var pts = [item.x, item.y,
item.x1, item.y1,
item.x2, item.y2];
svgedit.path.replacePathSeg(seg.type, seg.index, pts);
seg.update(true);
@@ -543,16 +535,11 @@ svgedit.path.Segment.prototype.setLinked = function(num) {
svgedit.path.Segment.prototype.moveCtrl = function(num, dx, dy) {
var item = this.item;
item['x' + num] += dx;
item['y' + num] += dy;
// fix for path tool dom breakage, amending item does bad things now, so we take a copy and use that. Can probably improve to just take a shallow copy of object
var cloneItem = $.extend({}, item);
cloneItem['x' + num] += dx;
cloneItem['y' + num] += dy;
var pts = [cloneItem.x,cloneItem.y,
cloneItem.x1,cloneItem.y1, cloneItem.x2,cloneItem.y2];
// end fix
var pts = [item.x,item.y,
item.x1,item.y1, item.x2,item.y2];
svgedit.path.replacePathSeg(this.type, this.index, pts);
this.update(true);

View File

@@ -549,7 +549,7 @@ var getIntersectionList = this.getIntersectionList = function(rect) {
var rubberBBox;
if (!rect) {
rubberBBox = rubberBox.getBBox();
var o, bb = {};
var o, bb = svgcontent.createSVGRect();
for (o in rubberBBox) {
bb[o] = rubberBBox[o] / current_zoom;
@@ -560,12 +560,14 @@ var getIntersectionList = this.getIntersectionList = function(rect) {
}
var resultList = null;
if (typeof(svgroot.getIntersectionList) == 'function') {
// Offset the bbox of the rubber box by the offset of the svgcontent element.
rubberBBox.x += parseInt(svgcontent.getAttribute('x'), 10);
rubberBBox.y += parseInt(svgcontent.getAttribute('y'), 10);
if (!svgedit.browser.isIE) {
if (typeof(svgroot.getIntersectionList) == 'function') {
// Offset the bbox of the rubber box by the offset of the svgcontent element.
rubberBBox.x += parseInt(svgcontent.getAttribute('x'), 10);
rubberBBox.y += parseInt(svgcontent.getAttribute('y'), 10);
resultList = svgroot.getIntersectionList(rubberBBox, parent);
resultList = svgroot.getIntersectionList(rubberBBox, parent);
}
}
if (resultList == null || typeof(resultList.item) != 'function') {