add 'ignore colors during export' options

pull/68/head
Michael Aschauer 2018-10-23 17:50:23 +02:00
rodzic 6ddf489044
commit 4412e54f2a
4 zmienionych plików z 31 dodań i 7 usunięć

Wyświetl plik

@ -1006,10 +1006,23 @@ IDE_Morph.prototype.createStatusDisplay = function () {
function () { myself.downloadSVG(); },
'Export as SVG'
);
//downloadSVGButton.columns = 4;
//downloadSVGButton.newColumn = 1;
downloadSVGButton.newLines = 1.7;
downloadSVGButton.columns = 6;
downloadSVGButton.newColumn = 2;
elements.push(downloadSVGButton);
var ignoreColorsButton = new ToggleMorph(
'checkbox',
null,
function () {
stage.turtleShepherd.toggleIgnoreColors();
},
'Ignore colors during export',
function () {
return stage.turtleShepherd.getIgnoreColors();
});
ignoreColorsButton.newLines = 1.7;
elements.push(ignoreColorsButton);
var downloadEXPButton = new PushButtonMorph(
null,

Wyświetl plik

@ -68,6 +68,8 @@ tempDict = {
'Exportieren zum Ausstickservice',
'Export to stitchcode.com\'s embroidery service':
'Exportiert die aktuelle Zeichnung zum stitchcode.com Ausstickservice',
'Ignore colors during export':
'Ignoriere Farben beim Export',
'move %n steps by %n steps':
'gehe %n Schritte in %n er Schritten',

Wyświetl plik

@ -1809,8 +1809,8 @@ SpriteMorph.prototype.blockTemplates = function (category) {
blocks.push(block('up'));
blocks.push(block('isPenDown'));
blocks.push('-');
blocks.push(block('setSize'));
blocks.push(block('changeSize'));
blocks.push(block('setSize'));
blocks.push(block('getPenSize'));
blocks.push('-');
blocks.push(block('setOpacity'));

Wyświetl plik

@ -25,6 +25,7 @@ TurtleShepherd.prototype.init = function() {
this.oldColor = 0;
this.penSize = 1;
this.newPenSize = 0;
this.ignoreColors = false;
};
@ -65,6 +66,14 @@ TurtleShepherd.prototype.isMetric = function() {
return this.metric;
};
TurtleShepherd.prototype.getIgnoreColors = function() {
return this.ignoreColors;
};
TurtleShepherd.prototype.toggleIgnoreColors = function() {
this.ignoreColors = !this.ignoreColors;
};
TurtleShepherd.prototype.isEmpty = function() {
return this.steps < 1;
};
@ -366,7 +375,7 @@ TurtleShepherd.prototype.toSVG = function() {
color = { r:0, g:0, b:0, a:1 };
for (var i=0; i < this.cache.length; i++) {
if (this.cache[i].cmd == "color") {
if (this.cache[i].cmd == "color" && !this.ignoreColors) {
color = this.cache[i].color;
colorChanged = true;
if (tagOpen) svgStr += '" />\n';
@ -449,7 +458,7 @@ TurtleShepherd.prototype.toEXP = function() {
}
for (var i=0; i < this.cache.length; i++) {
if (this.cache[i].cmd == "color") {
if (this.cache[i].cmd == "color" && !this.ignoreColors) {
expArr.push(0x80);
expArr.push(0x01);
expArr.push(0x00);
@ -700,7 +709,7 @@ TurtleShepherd.prototype.toDST = function() {
for (i=0; i < this.cache.length; i++) {
if (this.cache[i].cmd == "color") {
if (this.cache[i].cmd == "color" && !this.ignoreColors) {
expArr.push(0x00);
expArr.push(0x00);
expArr.push(0xC3);