fixes #11 SVG line color control

This commit is contained in:
Stewart Allen 2017-12-06 14:09:29 -05:00
commit 9ff0eb8c99
5 changed files with 8 additions and 6 deletions

View file

@ -260,8 +260,9 @@ var gs_kiri_laser = exports;
/** /**
* *
*/ */
LASER.exportSVG = function(print) { LASER.exportSVG = function(print, cut_color) {
var lines = [], dx = 0, dy = 0, my; var lines = [], dx = 0, dy = 0, my;
var color = cut_color || "blue";
exportElements( exportElements(
print, print,
@ -276,7 +277,7 @@ var gs_kiri_laser = exports;
lines.push('<svg width="'+width+'mm" height="'+height+'mm" viewBox="0 0 '+width+' '+height+'" xmlns="http://www.w3.org/2000/svg" version="1.1">'); lines.push('<svg width="'+width+'mm" height="'+height+'mm" viewBox="0 0 '+width+' '+height+'" xmlns="http://www.w3.org/2000/svg" version="1.1">');
}, },
function(poly) { function(poly) {
lines.push('<polyline points="'+poly.join(' ')+'" fill="none" stroke="blue" stroke-width="0.01mm" />'); lines.push('<polyline points="'+poly.join(' ')+'" fill="none" stroke="' + color + '" stroke-width="0.01mm" />');
}, },
function() { function() {
lines.push("</svg>"); lines.push("</svg>");

View file

@ -202,8 +202,8 @@ var gs_kiri_print = exports;
return KIRI.driver.LASER.exportGCode(this); return KIRI.driver.LASER.exportGCode(this);
}; };
PRO.exportSVG = function() { PRO.exportSVG = function(cut_color) {
return KIRI.driver.LASER.exportSVG(this); return KIRI.driver.LASER.exportSVG(this, cut_color);
}; };
PRO.exportDXF = function() { PRO.exportDXF = function() {

View file

@ -893,7 +893,7 @@ self.kiri.license = exports.LICENSE;
function download_svg() { function download_svg() {
saveAs(new Blob( saveAs(new Blob(
[currentPrint.exportSVG()], [currentPrint.exportSVG($('print-color').value)],
{type:"application/octet-stream"}), {type:"application/octet-stream"}),
$('print-filename').value + ".svg"); $('print-filename').value + ".svg");
} }

View file

@ -1,7 +1,7 @@
var exports = { var exports = {
COPYRIGHT:"Copyright (C) 2014-2017 Stewart Allen <stewart@neuron.com> - All Rights Reserved", COPYRIGHT:"Copyright (C) 2014-2017 Stewart Allen <stewart@neuron.com> - All Rights Reserved",
LICENSE:"Unauthorized copying, modification and re-distribution are strictly prohibited without prior written consent.", LICENSE:"Unauthorized copying, modification and re-distribution are strictly prohibited without prior written consent.",
VERSION:"1.0.69" VERSION:"1.0.70"
}; };
if (!module) var module = {}; if (!module) var module = {};
module.exports = exports; module.exports = exports;

View file

@ -6,6 +6,7 @@
<table id="print-info"> <table id="print-info">
<tr><th>file name</th><td><input id="print-filename" size="30" spellcheck="false" /></td></tr> <tr><th>file name</th><td><input id="print-filename" size="30" spellcheck="false" /></td></tr>
<tr><th>segments</th><td><input id="print-lines" size="10" disabled="true" /></td></tr> <tr><th>segments</th><td><input id="print-lines" size="10" disabled="true" /></td></tr>
<tr><th>svg cut color</th><td><input id="print-color" size="10" value="blue" title="must be a valid SVG color" /></td></tr>
</table> </table>
</div> </div>