Move remapElement() to coords and add a first unit test

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2416 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
Jeff Schiller
2013-02-17 04:58:04 +00:00
parent 4441810638
commit 29534a7d4b
4 changed files with 445 additions and 375 deletions

View File

@@ -11,6 +11,7 @@
// 1) jQuery
// 2) browser.js
// 3) svgtransformlist.js
// 4) units.js
(function() {
@@ -649,4 +650,17 @@ svgedit.utilities.cleanupElement = function(element) {
svgroot_.unsuspendRedraw(handle);
};
// Function: snapToGrid
// round value to for snapping
// NOTE: This function did not move to svgutils.js since it depends on curConfig.
svgedit.utilities.snapToGrid = function(value) {
var stepSize = editorContext_.getSnappingStep();
var unit = editorContext_.getBaseUnit();
if (unit !== "px") {
stepSize *= svgedit.units.getTypeMap()[unit];
}
value = Math.round(value/stepSize)*stepSize;
return value;
};
})();