fixed getRefElem and smoothControlPoints leaking variables
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2402 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
d5dca6b4a3
commit
7a36f90eb6
|
@ -356,7 +356,7 @@ svgedit.path.getSegSelector = function(seg, update) {
|
|||
//
|
||||
// Returns:
|
||||
// Array of two "smoothed" point objects
|
||||
svgedit.path.smoothControlPoints = this.smoothControlPoints = function(ct1, ct2, pt) {
|
||||
svgedit.path.smoothControlPoints = function(ct1, ct2, pt) {
|
||||
// each point must not be the origin
|
||||
var x1 = ct1.x - pt.x,
|
||||
y1 = ct1.y - pt.y,
|
||||
|
|
|
@ -723,7 +723,7 @@
|
|||
|
||||
// Call when part of element is in process of changing, generally
|
||||
// on mousemove actions like rotate, move, etc.
|
||||
var elementTransition = function(window,elems) {
|
||||
var elementTransition = function(window, elems) {
|
||||
var mode = svgCanvas.getMode();
|
||||
var elem = elems[0];
|
||||
|
||||
|
@ -970,7 +970,7 @@
|
|||
flyout_funcs[opt]();
|
||||
}
|
||||
});
|
||||
// $('#tools_rect').mouseleave(function(){$('#tools_rect').fadeOut();});
|
||||
// $('#tools_rect').mouseleave(function(){$('#tools_rect').fadeOut();});
|
||||
});
|
||||
setFlyoutTitles();
|
||||
};
|
||||
|
@ -1728,7 +1728,7 @@
|
|||
|
||||
// Set up editor background functionality
|
||||
// TODO add checkerboard as "pattern"
|
||||
var color_blocks = ['#FFF','#888','#000']; // ,'url(data:image/gif;base64,R0lGODlhEAAQAIAAAP%2F%2F%2F9bW1iH5BAAAAAAALAAAAAAQABAAAAIfjG%2Bgq4jM3IFLJgpswNly%2FXkcBpIiVaInlLJr9FZWAQA7)'];
|
||||
var color_blocks = ['#FFF', '#888', '#000']; // ,'url(data:image/gif;base64,R0lGODlhEAAQAIAAAP%2F%2F%2F9bW1iH5BAAAAAAALAAAAAAQABAAAAIfjG%2Bgq4jM3IFLJgpswNly%2FXkcBpIiVaInlLJr9FZWAQA7)'];
|
||||
var str = '';
|
||||
$.each(color_blocks, function() {
|
||||
str += '<div class="color_block" style="background-color:' + this + ';"></div>';
|
||||
|
@ -1842,7 +1842,7 @@
|
|||
var promptMoveLayerOnce = false;
|
||||
$('#selLayerNames').change(function(){
|
||||
var destLayer = this.options[this.selectedIndex].value;
|
||||
var confirm_str = uiStrings.notification.QmoveElemsToLayer.replace('%s',destLayer);
|
||||
var confirmStr = uiStrings.notification.QmoveElemsToLayer.replace('%s', destLayer);
|
||||
var moveToLayer = function(ok) {
|
||||
if (!ok) return;
|
||||
promptMoveLayerOnce = true;
|
||||
|
@ -1854,7 +1854,7 @@
|
|||
if (promptMoveLayerOnce) {
|
||||
moveToLayer(true);
|
||||
} else {
|
||||
$.confirm(confirm_str, moveToLayer);
|
||||
$.confirm(confirmStr, moveToLayer);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -71,7 +71,6 @@ if (window.opera) {
|
|||
obj[aname] = attr;
|
||||
}
|
||||
return obj;
|
||||
|
||||
} else if (typeof key === "object") {
|
||||
// Setting attributes form object
|
||||
for (var v in key) {
|
||||
|
@ -91,7 +90,6 @@ if (window.opera) {
|
|||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
}());
|
||||
|
||||
// Class: SvgCanvas
|
||||
|
@ -345,7 +343,6 @@ canvas.undoMgr = new svgedit.history.UndoManager({
|
|||
var elems = cmd.elements();
|
||||
canvas.pathActions.clear();
|
||||
call("changed", elems);
|
||||
|
||||
var cmdType = cmd.type();
|
||||
var isApply = (eventType == EventTypes.AFTER_APPLY);
|
||||
if (cmdType == MoveElementCommand.type()) {
|
||||
|
@ -363,7 +360,6 @@ canvas.undoMgr = new svgedit.history.UndoManager({
|
|||
} else {
|
||||
if (!isApply) restoreRefElems(cmd.elem);
|
||||
}
|
||||
|
||||
if (cmd.elem.tagName === 'use') {
|
||||
setUseData(cmd.elem);
|
||||
}
|
||||
|
@ -668,9 +664,7 @@ getStrokedBBox = this.getStrokedBBox = function(elems) {
|
|||
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) {
|
||||
|
@ -1369,9 +1363,7 @@ var remapElement = this.remapElement = function(selected, changes, m) {
|
|||
// ty - The translation's y value
|
||||
var updateClipPath = function(attr, tx, ty) {
|
||||
var path = getRefElem(attr).firstChild;
|
||||
|
||||
var cp_xform = svgedit.transformlist.getTransformList(path);
|
||||
|
||||
var newxlate = svgroot.createSVGTransform();
|
||||
newxlate.setTranslate(tx, ty);
|
||||
|
||||
|
|
|
@ -316,8 +316,7 @@ svgedit.utilities.findDefs = function() {
|
|||
var defs = svgElement.getElementsByTagNameNS(SVGNS, 'defs');
|
||||
if (defs.length > 0) {
|
||||
defs = defs[0];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
defs = svgElement.ownerDocument.createElementNS(SVGNS, 'defs');
|
||||
if (svgElement.firstChild) {
|
||||
// first child is a comment, so call nextSibling
|
||||
|
@ -386,7 +385,6 @@ svgedit.utilities.getPathBBox = function(path) {
|
|||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
var b2ac = Math.pow(b,2) - 4 * c * a;
|
||||
if(b2ac < 0) continue;
|
||||
var t1 = (-b + Math.sqrt(b2ac))/(2 * a);
|
||||
|
@ -497,7 +495,6 @@ svgedit.utilities.getBBox = function(elem) {
|
|||
if(elname === 'use') {
|
||||
ret = groupBBFix(selected, true);
|
||||
}
|
||||
|
||||
if(elname === 'use' || ( elname === 'foreignObject' && svgedit.browser.isWebkit() ) ) {
|
||||
if(!ret) ret = selected.getBBox();
|
||||
// This is resolved in later versions of webkit, perhaps we should
|
||||
|
@ -528,7 +525,6 @@ svgedit.utilities.getBBox = function(elem) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(ret) {
|
||||
ret = svgedit.utilities.bboxToObj(ret);
|
||||
}
|
||||
|
@ -566,7 +562,7 @@ svgedit.utilities.getRotationAngle = function(elem, to_rad) {
|
|||
//
|
||||
// Parameters:
|
||||
// attrVal - The attribute value as a string
|
||||
svgedit.utilities.getRefElem = this.getRefElem = function(attrVal) {
|
||||
svgedit.utilities.getRefElem = function(attrVal) {
|
||||
return svgedit.utilities.getElem(svgedit.utilities.getUrlFromAttr(attrVal).substr(1));
|
||||
};
|
||||
|
||||
|
@ -622,9 +618,7 @@ svgedit.utilities.assignAttributes = function(node, attrs, suspendLength, unitCh
|
|||
} else {
|
||||
svgedit.units.setUnitAttr(node, i, attrs[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!svgedit.browser.isOpera()) svgroot_.unsuspendRedraw(handle);
|
||||
};
|
||||
|
||||
|
@ -659,5 +653,4 @@ svgedit.utilities.cleanupElement = function(element) {
|
|||
svgroot_.unsuspendRedraw(handle);
|
||||
};
|
||||
|
||||
|
||||
})();
|
||||
|
|
|
@ -225,17 +225,16 @@ svgedit.units.convertToNum = function(attr, val) {
|
|||
|
||||
if (wAttrs.indexOf(attr) >= 0) {
|
||||
return num * width;
|
||||
} else if (hAttrs.indexOf(attr) >= 0) {
|
||||
return num * height;
|
||||
} else {
|
||||
return num * Math.sqrt((width*width) + (height*height))/Math.sqrt(2);
|
||||
}
|
||||
} else {
|
||||
var unit = val.substr(-2);
|
||||
var num = val.substr(0, val.length-2);
|
||||
// Note that this multiplication turns the string into a number
|
||||
return num * typeMap_[unit];
|
||||
if (hAttrs.indexOf(attr) >= 0) {
|
||||
return num * height;
|
||||
}
|
||||
return num * Math.sqrt((width*width) + (height*height))/Math.sqrt(2);
|
||||
}
|
||||
var unit = val.substr(-2);
|
||||
var num = val.substr(0, val.length-2);
|
||||
// Note that this multiplication turns the string into a number
|
||||
return num * typeMap_[unit];
|
||||
};
|
||||
|
||||
// Function: svgedit.units.isValidUnit
|
||||
|
|
Loading…
Reference in New Issue