change coords

master
vitrinekast 10 months ago
parent c26057019f
commit 55bbf32e68

@ -70,7 +70,7 @@ const parseMessage = (message) => {
} else {
switch (message.toLowerCase()) {
case 'init':
toPlotter(translate());
toPlotter(init());
break;
case 'pu':
toPlotter(`PU;`);
@ -79,7 +79,7 @@ const parseMessage = (message) => {
toPlotter(`PD;`);
break;
case 'up':
toPlotter(translate(distance * -1, 0));
toPlotter(translate(0, distance * -1));
break;
case 'down':
toPlotter(translate(0, distance));
@ -88,10 +88,7 @@ const parseMessage = (message) => {
toPlotter(translate(distance * -1, 0));
break;
case 'right':
toPlotter(translate(0, distance));
break;
case 'right':
toPlotter(translate(0, distance));
toPlotter(translate(distance, 0));
break;
case 'rectangle':
toPlotter(rectangle(distance));

@ -10,12 +10,15 @@ function init(width = 4000, height = 4000) {
}
function translate(x = 0, y = 0) {
console.log(`translate: ${x} ${y}`);
state.position.x += x;
state.position.y += y;
console.log(`translate: ${state.position.x}`);
clampPosition();
return `PR${state.position.x},${state.position.y};`
return `PA${state.position.x},${state.position.y};`
}
function to(x = 0, y = 0) {

Loading…
Cancel
Save