dev/server/public/admin/vendor/svg-edit-2.7/svgcanvas.js
function(elem) {

		try {
			// TODO: Fix issue with rotated groups. Currently they work
			// fine in FF, but not in other browsers (same problem mentioned
			// in Issue 339 comment #2).

			var bb = svgedit.utilities.getBBox(elem);
			var angle = svgedit.utilities.getRotationAngle(elem);

			if ((angle && angle % 90) ||
				svgedit.math.hasMatrixTransform(svgedit.transformlist.getTransformList(elem))) {
				// Accurate way to get BBox of rotated element in Firefox:
				// Put element in group and get its BBox
				var good_bb = false;
				// Get the BBox from the raw path for these elements
				var elemNames = ['ellipse', 'path', 'line', 'polyline', 'polygon'];
				if (elemNames.indexOf(elem.tagName) >= 0) {
					bb = good_bb = canvas.convertToPath(elem, true);
				} else if (elem.tagName == 'rect') {
					// Look for radius
					var rx = elem.getAttribute('rx');
					var ry = elem.getAttribute('ry');
					if (rx || ry) {
						bb = good_bb = canvas.convertToPath(elem, true);
					}
				}

				if (!good_bb) {
					// Must use clone else FF freaks out
					var clone = elem.cloneNode(true);
					var g = document.createElementNS(NS.SVG, "g");
					var parent = elem.parentNode;
					parent.appendChild(g);
					g.appendChild(clone);
					bb = svgedit.utilities.bboxToObj(g.getBBox());
					parent.removeChild(g);
				}

				// Old method: Works by giving the rotated BBox,
				// this is (unfortunately) what Opera and Safari do
				// natively when getting the BBox of the parent group
//						var angle = angle * Math.PI / 180.0;
//						var rminx = Number.MAX_VALUE, rminy = Number.MAX_VALUE, 
//							rmaxx = Number.MIN_VALUE, rmaxy = Number.MIN_VALUE;
//						var cx = round(bb.x + bb.width/2),
//							cy = round(bb.y + bb.height/2);
//						var pts = [ [bb.x - cx, bb.y - cy], 
//									[bb.x + bb.width - cx, bb.y - cy],
//									[bb.x + bb.width - cx, bb.y + bb.height - cy],
//									[bb.x - cx, bb.y + bb.height - cy] ];
//						var j = 4;
//						while (j--) {
//							var x = pts[j][0],
//								y = pts[j][1],
//								r = Math.sqrt( x*x + y*y );
//							var theta = Math.atan2(y,x) + angle;
//							x = round(r * Math.cos(theta) + cx);
//							y = round(r * Math.sin(theta) + cy);
//		
//							// now set the bbox for the shape after it's been rotated
//							if (x < rminx) rminx = x;
//							if (y < rminy) rminy = y;
//							if (x > rmaxx) rmaxx = x;
//							if (y > rmaxy) rmaxy = y;
//						}
//						
//						bb.x = rminx;
//						bb.y = rminy;
//						bb.width = rmaxx - rminx;
//						bb.height = rmaxy - rminy;
			}
			return bb;
		} catch(e) {
			console.log(elem, e);
			return null;
		}
	}
function(elem) {

		try {
			// TODO: Fix issue with rotated groups. Currently they work
			// fine in FF, but not in other browsers (same problem mentioned
			// in Issue 339 comment #2).

			var bb = svgedit.utilities.getBBox(elem);
			var angle = svgedit.utilities.getRotationAngle(elem);

			if ((angle && angle % 90) ||
				svgedit.math.hasMatrixTransform(svgedit.transformlist.getTransformList(elem))) {
				// Accurate way to get BBox of rotated element in Firefox:
				// Put element in group and get its BBox
				var good_bb = false;
				// Get the BBox from the raw path for these elements
				var elemNames = ['ellipse', 'path', 'line', 'polyline', 'polygon'];
				if (elemNames.indexOf(elem.tagName) >= 0) {
					bb = good_bb = canvas.convertToPath(elem, true);
				} else if (elem.tagName == 'rect') {
					// Look for radius
					var rx = elem.getAttribute('rx');
					var ry = elem.getAttribute('ry');
					if (rx || ry) {
						bb = good_bb = canvas.convertToPath(elem, true);
					}
				}

				if (!good_bb) {
					// Must use clone else FF freaks out
					var clone = elem.cloneNode(true);
					var g = document.createElementNS(NS.SVG, "g");
					var parent = elem.parentNode;
					parent.appendChild(g);
					g.appendChild(clone);
					bb = svgedit.utilities.bboxToObj(g.getBBox());
					parent.removeChild(g);
				}

				// Old method: Works by giving the rotated BBox,
				// this is (unfortunately) what Opera and Safari do
				// natively when getting the BBox of the parent group
//						var angle = angle * Math.PI / 180.0;
//						var rminx = Number.MAX_VALUE, rminy = Number.MAX_VALUE, 
//							rmaxx = Number.MIN_VALUE, rmaxy = Number.MIN_VALUE;
//						var cx = round(bb.x + bb.width/2),
//							cy = round(bb.y + bb.height/2);
//						var pts = [ [bb.x - cx, bb.y - cy], 
//									[bb.x + bb.width - cx, bb.y - cy],
//									[bb.x + bb.width - cx, bb.y + bb.height - cy],
//									[bb.x - cx, bb.y + bb.height - cy] ];
//						var j = 4;
//						while (j--) {
//							var x = pts[j][0],
//								y = pts[j][1],
//								r = Math.sqrt( x*x + y*y );
//							var theta = Math.atan2(y,x) + angle;
//							x = round(r * Math.cos(theta) + cx);
//							y = round(r * Math.sin(theta) + cy);
//		
//							// now set the bbox for the shape after it's been rotated
//							if (x < rminx) rminx = x;
//							if (y < rminy) rminy = y;
//							if (x > rmaxx) rmaxx = x;
//							if (y > rmaxy) rmaxy = y;
//						}
//						
//						bb.x = rminx;
//						bb.y = rminy;
//						bb.width = rmaxx - rminx;
//						bb.height = rmaxy - rminy;
			}
			return bb;
		} catch(e) {
			console.log(elem, e);
			return null;
		}
	}
function ( elem ) { try { // TODO: Fix issue with rotated groups. Currently they work // fine in FF, but not in other browsers (same problem mentioned // in Issue 339 comment #2). var bb = svgedit . utilities . getBBox ( elem ) ; var angle = svgedit . utilities . getRotationAngle ( elem ) ; if ( ( angle && angle % 90 ) || svgedit . math . hasMatrixTransform ( svgedit . transformlist . getTransformList ( elem ) ) ) { // Accurate way to get BBox of rotated element in Firefox: // Put element in group and get its BBox var good_bb = false ; // Get the BBox from the raw path for these elements var elemNames = [ 'ellipse' , 'path' , 'line' , 'polyline' , 'polygon' ] ; if ( elemNames . indexOf ( elem . tagName ) >= 0 ) { bb = good_bb = canvas . convertToPath ( elem , true ) ; } else if ( elem . tagName == 'rect' ) { // Look for radius var rx = elem . getAttribute ( 'rx' ) ; var ry = elem . getAttribute ( 'ry' ) ; if ( rx || ry ) { bb = good_bb = canvas . convertToPath ( elem , true ) ; } } if ( ! good_bb ) { // Must use clone else FF freaks out var clone = elem . cloneNode ( true ) ; var g = document . createElementNS ( NS . SVG , "g" ) ; var parent = elem . parentNode ; parent . appendChild ( g ) ; g . appendChild ( clone ) ; bb = svgedit . utilities . bboxToObj ( g . getBBox ( ) ) ; parent . removeChild ( g ) ; } // Old method: Works by giving the rotated BBox, // this is (unfortunately) what Opera and Safari do // natively when getting the BBox of the parent group //						var angle = angle * Math.PI / 180.0; //						var rminx = Number.MAX_VALUE, rminy = Number.MAX_VALUE,  //							rmaxx = Number.MIN_VALUE, rmaxy = Number.MIN_VALUE; //						var cx = round(bb.x + bb.width/2), //							cy = round(bb.y + bb.height/2); //						var pts = [ [bb.x - cx, bb.y - cy],  //									[bb.x + bb.width - cx, bb.y - cy], //									[bb.x + bb.width - cx, bb.y + bb.height - cy], //									[bb.x - cx, bb.y + bb.height - cy] ]; //						var j = 4; //						while (j--) { //							var x = pts[j][0], //								y = pts[j][1], //								r = Math.sqrt( x*x + y*y ); //							var theta = Math.atan2(y,x) + angle; //							x = round(r * Math.cos(theta) + cx); //							y = round(r * Math.sin(theta) + cy); //		 //							// now set the bbox for the shape after it's been rotated //							if (x < rminx) rminx = x; //							if (y < rminy) rminy = y; //							if (x > rmaxx) rmaxx = x; //							if (y > rmaxy) rmaxy = y; //						} //						 //						bb.x = rminx; //						bb.y = rminy; //						bb.width = rmaxx - rminx; //						bb.height = rmaxy - rminy; } return bb ; } catch ( e ) { console . log ( elem , e ) ; return null ; } }
Make sure the expected BBox is returned if the element is a group
Make sure the expected BBox is returned if the element is a group