Overhaul of grid extension to make grid appear better and change based on the current unit type

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1813 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
Alexis Deveria
2010-10-21 17:02:12 +00:00
parent 5aabcff60c
commit f367dde12b
2 changed files with 108 additions and 77 deletions

View File

@@ -402,6 +402,10 @@ var Utils = this.Utils = function() {
// round value to for snapping
"snapToGrid" : function(value){
var stepSize = curConfig.snappingStep;
var unit = curConfig.baseUnit;
if(unit !== "px") {
stepSize *= unit_types[unit];
}
value = Math.round(value/stepSize)*stepSize;
return value;
},
@@ -488,6 +492,7 @@ var canvas = this,
container.appendChild(svgroot);
// The actual element that represents the final output SVG element
var svgcontent = svgdoc.createElementNS(svgns, "svg");
$(svgcontent).attr({
@@ -8515,10 +8520,6 @@ var convertToGroup = this.convertToGroup = function(elem) {
selectOnly([g]);
// Temporary hack to get rid of matrix
// TODO: See what ungroupSelectedElement does to absorb matrix
// canvas.ungroupSelectedElement();
// canvas.groupSelectedElements();
batchCmd.addSubCommand(pushGroupProperties(g, true));
//
addCommandToHistory(batchCmd);