work in progress

This commit is contained in:
Teja 2015-05-23 11:58:36 +02:00
parent 83fb2cb92a
commit 7297343ca0
2 changed files with 5 additions and 1 deletions

View file

@ -143,7 +143,7 @@ class SvgToGcodePlugin(octoprint.plugin.SlicerPlugin,
def get_assets(self):
return {
"js": [ "js/convert.js", "js/working_area.js", "js/gcode_parser.js", "js/lib/snap.svg-min.js"],
"js": [ "js/convert.js", "js/working_area.js", "js/gcode_parser.js", "js/lib/snap.svg-min.js", "js/bake_snap_plugin.js"],
"less": ["less/svgtogcode.less"],
"css": ["css/svgtogcode.css", "css/mrbeam.css"]
}

View file

@ -230,16 +230,20 @@ $(function(){
}
}
// scale matrix
var mat = self.getDocumentViewBoxMatrix(doc_width, doc_height, doc_viewbox);
var scaleMatrixStr = new Snap.Matrix(mat[0][0],mat[0][1],mat[1][0],mat[1][1],mat[0][2],mat[1][2]).toTransformString();
newSvgAttrs['transform'] = scaleMatrixStr;
var newSvg = snap.group(f.selectAll("svg>*"));
newSvg.bake();
newSvg.attr(newSvgAttrs);
var id = self.getEntryId(file);
var previewId = self.generateUniqueId(id); // appends -# if multiple times the same design is placed.
newSvg.attr({id: previewId});
snap.select("#userContent").append(newSvg);
//flatten(document.getElementById(previewId), false, true, false, 4)
//newSvg.attr({transform: scaleMatrixStr});
newSvg.drag();// TODO debug drag. should not be affected by scale matrix