Remove all suspendRedraws

This commit is contained in:
Jeff Schiller
2015-11-30 18:59:53 -08:00
parent c6d651e82d
commit 59303eb6cc
3 changed files with 5 additions and 30 deletions

View File

@@ -93,6 +93,7 @@ svgedit.select.Selector.prototype.reset = function(e) {
this.selectorGroup.setAttribute('display', 'inline'); this.selectorGroup.setAttribute('display', 'inline');
}; };
// Function: svgedit.select.Selector.updateGripCursors // Function: svgedit.select.Selector.updateGripCursors
// Updates cursors for corner grips on rotation so arrows point the right way // Updates cursors for corner grips on rotation so arrows point the right way
// //
@@ -123,7 +124,6 @@ svgedit.select.Selector.prototype.updateGripCursors = function(angle) {
// Parameters: // Parameters:
// show - boolean indicating whether grips should be shown or not // show - boolean indicating whether grips should be shown or not
svgedit.select.Selector.prototype.showGrips = function(show) { svgedit.select.Selector.prototype.showGrips = function(show) {
// TODO: use suspendRedraw() here
var bShow = show ? 'inline' : 'none'; var bShow = show ? 'inline' : 'none';
selectorManager_.selectorGripsGroup.setAttribute('display', bShow); selectorManager_.selectorGripsGroup.setAttribute('display', bShow);
var elem = this.selectedElement; var elem = this.selectedElement;
@@ -222,7 +222,6 @@ svgedit.select.Selector.prototype.resize = function() {
nbaw = (maxx-minx); nbaw = (maxx-minx);
nbah = (maxy-miny); nbah = (maxy-miny);
} }
var sr_handle = svgFactory_.svgRoot().suspendRedraw(100);
var dstr = 'M' + nbax + ',' + nbay var dstr = 'M' + nbax + ',' + nbay
+ ' L' + (nbax+nbaw) + ',' + nbay + ' L' + (nbax+nbaw) + ',' + nbay
@@ -261,8 +260,6 @@ svgedit.select.Selector.prototype.resize = function() {
mgr.rotateGrip.setAttribute('cx', nbax + (nbaw)/2); mgr.rotateGrip.setAttribute('cx', nbax + (nbaw)/2);
mgr.rotateGrip.setAttribute('cy', nbay - (gripRadius*5)); mgr.rotateGrip.setAttribute('cy', nbay - (gripRadius*5));
// } // }
svgFactory_.svgRoot().unsuspendRedraw(sr_handle);
}; };
@@ -450,12 +447,12 @@ svgedit.select.SelectorManager.prototype.releaseSelector = function(elem) {
var i, var i,
N = this.selectors.length, N = this.selectors.length,
sel = this.selectorMap[elem.id]; sel = this.selectorMap[elem.id];
if (!sel.locked) {
// TODO(codedread): Ensure this exists in this module.
console.log('WARNING! selector was released but was already unlocked');
}
for (i = 0; i < N; ++i) { for (i = 0; i < N; ++i) {
if (this.selectors[i] && this.selectors[i] == sel) { if (this.selectors[i] && this.selectors[i] == sel) {
if (sel.locked == false) {
// TODO(codedread): Ensure this exists in this module.
console.log('WARNING! selector was released but was already unlocked');
}
delete this.selectorMap[elem.id]; delete this.selectorMap[elem.id];
sel.locked = false; sel.locked = false;
sel.selectedElement = null; sel.selectedElement = null;

View File

@@ -1896,10 +1896,6 @@ var getMouseTarget = this.getMouseTarget = function(evt) {
}, 1000); }, 1000);
break; break;
case 'line': case 'line':
// Opera has a problem with suspendRedraw() apparently
var handle = null;
if (!window.opera) {svgroot.suspendRedraw(1000);}
if (curConfig.gridSnapping) { if (curConfig.gridSnapping) {
x = svgedit.utilities.snapToGrid(x); x = svgedit.utilities.snapToGrid(x);
y = svgedit.utilities.snapToGrid(y); y = svgedit.utilities.snapToGrid(y);
@@ -1916,7 +1912,6 @@ var getMouseTarget = this.getMouseTarget = function(evt) {
shape.setAttributeNS(null, 'x2', x2); shape.setAttributeNS(null, 'x2', x2);
shape.setAttributeNS(null, 'y2', y2); shape.setAttributeNS(null, 'y2', y2);
if (!window.opera) {svgroot.unsuspendRedraw(handle);}
break; break;
case 'foreignObject': case 'foreignObject':
// fall through // fall through
@@ -1967,9 +1962,6 @@ var getMouseTarget = this.getMouseTarget = function(evt) {
c = $(shape).attr(['cx', 'cy']); c = $(shape).attr(['cx', 'cy']);
cx = c.cx; cx = c.cx;
cy = c.cy; cy = c.cy;
// Opera has a problem with suspendRedraw() apparently
handle = null;
if (!window.opera) {svgroot.suspendRedraw(1000);}
if (curConfig.gridSnapping) { if (curConfig.gridSnapping) {
x = svgedit.utilities.snapToGrid(x); x = svgedit.utilities.snapToGrid(x);
cx = svgedit.utilities.snapToGrid(cx); cx = svgedit.utilities.snapToGrid(cx);
@@ -1979,7 +1971,6 @@ var getMouseTarget = this.getMouseTarget = function(evt) {
shape.setAttributeNS(null, 'rx', Math.abs(x - cx) ); shape.setAttributeNS(null, 'rx', Math.abs(x - cx) );
var ry = Math.abs(evt.shiftKey?(x - cx):(y - cy)); var ry = Math.abs(evt.shiftKey?(x - cx):(y - cy));
shape.setAttributeNS(null, 'ry', ry ); shape.setAttributeNS(null, 'ry', ry );
if (!window.opera) {svgroot.unsuspendRedraw(handle);}
break; break;
case 'fhellipse': case 'fhellipse':
case 'fhrect': case 'fhrect':
@@ -5681,7 +5672,6 @@ this.setResolution = function(x, y) {
} }
} }
if (x != w || y != h) { if (x != w || y != h) {
var handle = svgroot.suspendRedraw(1000);
if (!batchCmd) { if (!batchCmd) {
batchCmd = new svgedit.history.BatchCommand('Change Image Dimensions'); batchCmd = new svgedit.history.BatchCommand('Change Image Dimensions');
} }
@@ -5700,7 +5690,6 @@ this.setResolution = function(x, y) {
batchCmd.addSubCommand(new svgedit.history.ChangeElementCommand(svgcontent, {'viewBox': ['0 0', w, h].join(' ')})); batchCmd.addSubCommand(new svgedit.history.ChangeElementCommand(svgcontent, {'viewBox': ['0 0', w, h].join(' ')}));
addCommandToHistory(batchCmd); addCommandToHistory(batchCmd);
svgroot.unsuspendRedraw(handle);
call('changed', [svgcontent]); call('changed', [svgcontent]);
} }
return true; return true;
@@ -6770,7 +6759,6 @@ this.convertToPath = function(elem, getBBox) {
// newValue - String or number with the new attribute value // newValue - String or number with the new attribute value
// elems - The DOM elements to apply the change to // elems - The DOM elements to apply the change to
var changeSelectedAttributeNoUndo = function(attr, newValue, elems) { var changeSelectedAttributeNoUndo = function(attr, newValue, elems) {
var handle = svgroot.suspendRedraw(1000);
if (current_mode == 'pathedit') { if (current_mode == 'pathedit') {
// Editing node // Editing node
pathActions.moveNode(attr, newValue); pathActions.moveNode(attr, newValue);
@@ -6883,7 +6871,6 @@ var changeSelectedAttributeNoUndo = function(attr, newValue, elems) {
} }
} // if oldValue != newValue } // if oldValue != newValue
} // for each elem } // for each elem
svgroot.unsuspendRedraw(handle);
}; };
// Function: changeSelectedAttribute // Function: changeSelectedAttribute

View File

@@ -603,11 +603,6 @@ if (svgedit.browser.supportsSelectors()) {
// suspendLength - Optional integer of milliseconds to suspend redraw // suspendLength - Optional integer of milliseconds to suspend redraw
// unitCheck - Boolean to indicate the need to use svgedit.units.setUnitAttr // unitCheck - Boolean to indicate the need to use svgedit.units.setUnitAttr
svgedit.utilities.assignAttributes = function(node, attrs, suspendLength, unitCheck) { svgedit.utilities.assignAttributes = function(node, attrs, suspendLength, unitCheck) {
if(!suspendLength) {suspendLength = 0;}
// Opera has a problem with suspendRedraw() apparently
var handle = null;
if (!svgedit.browser.isOpera()) {svgroot_.suspendRedraw(suspendLength);}
var i; var i;
for (i in attrs) { for (i in attrs) {
var ns = (i.substr(0,4) === 'xml:' ? NS.XML : var ns = (i.substr(0,4) === 'xml:' ? NS.XML :
@@ -621,7 +616,6 @@ svgedit.utilities.assignAttributes = function(node, attrs, suspendLength, unitCh
svgedit.units.setUnitAttr(node, i, attrs[i]); svgedit.units.setUnitAttr(node, i, attrs[i]);
} }
} }
if (!svgedit.browser.isOpera()) {svgroot_.unsuspendRedraw(handle);}
}; };
// Function: cleanupElement // Function: cleanupElement
@@ -630,7 +624,6 @@ svgedit.utilities.assignAttributes = function(node, attrs, suspendLength, unitCh
// Parameters: // Parameters:
// element - DOM element to clean up // element - DOM element to clean up
svgedit.utilities.cleanupElement = function(element) { svgedit.utilities.cleanupElement = function(element) {
var handle = svgroot_.suspendRedraw(60);
var defaults = { var defaults = {
'fill-opacity':1, 'fill-opacity':1,
'stop-opacity':1, 'stop-opacity':1,
@@ -652,8 +645,6 @@ svgedit.utilities.cleanupElement = function(element) {
element.removeAttribute(attr); element.removeAttribute(attr);
} }
} }
svgroot_.unsuspendRedraw(handle);
}; };
// Function: snapToGrid // Function: snapToGrid