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:
@@ -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;
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user