Skip to content

Commit a04c518

Browse files
committed
cleanup
1 parent 4ebd487 commit a04c518

File tree

1 file changed

+54
-54
lines changed

1 file changed

+54
-54
lines changed

packages/pstricks/src/lib/psgraph.ts

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { select, Y } from '@latex2js/utils';
1+
import { Y } from '@latex2js/utils';
22

33
function arrow(x1: number, y1: number, x2: number, y2: number) {
44
var t = Math.PI / 6;
@@ -513,62 +513,62 @@ const psgraph: any = {
513513
svg.selectAll('.userline').remove();
514514
svg.selectAll('.psplot').remove();
515515
var currentEnvironment: { [key: string]: any } = {};
516-
516+
517517
Object.entries(plots || {})
518-
.forEach(([k, plot]: [string, any]) => {
519-
if (k.match(/uservariable/)) {
520-
plot.forEach((data: any) => {
521-
data.env.userx = coords[0];
522-
data.env.usery = coords[1];
523-
var dd = data.fn.call(data.env, data.match);
524-
currentEnvironment[data.data.name] = dd.value;
525-
});
526-
}
527-
});
528-
518+
.forEach(([k, plot]: [string, any]) => {
519+
if (k.match(/uservariable/)) {
520+
plot.forEach((data: any) => {
521+
data.env.userx = coords[0];
522+
data.env.usery = coords[1];
523+
var dd = data.fn.call(data.env, data.match);
524+
currentEnvironment[data.data.name] = dd.value;
525+
});
526+
}
527+
});
528+
529529
Object.entries(plots || {})
530-
.forEach(([k, plot]: [string, any]) => {
531-
if (k.match(/psplot/)) {
532-
plot.forEach((data: any) => {
533-
Object.entries(currentEnvironment || {})
534-
.forEach(([name, variable]: [string, any]) => {
535-
data.env.variables[name] = variable;
530+
.forEach(([k, plot]: [string, any]) => {
531+
if (k.match(/psplot/)) {
532+
plot.forEach((data: any) => {
533+
Object.entries(currentEnvironment || {})
534+
.forEach(([name, variable]: [string, any]) => {
535+
data.env.variables[name] = variable;
536+
});
537+
var d = data.fn.call(data.env, data.match);
538+
d.global = {};
539+
Object.assign(d.global, env);
540+
psgraph[k].call(d, svg);
536541
});
537-
var d = data.fn.call(data.env, data.match);
538-
d.global = {};
539-
Object.assign(d.global, env);
540-
psgraph[k].call(d, svg);
541-
});
542-
}
543-
if (k.match(/userline/)) {
544-
plot.forEach((data: any) => {
545-
var d = data.fn.call(data.env, data.match);
546-
data.env.x2 = coords[0];
547-
data.env.y2 = coords[1];
548-
data.data.x2 = data.env.x2;
549-
data.data.y2 = data.env.y2;
550-
551-
if (data.data.xExp2) {
552-
data.data.x2 = d.userx2(coords);
553-
data.data.x1 = d.userx(coords);
554-
} else if (data.data.xExp) {
555-
data.data.x2 = d.userx(coords);
556-
}
557-
558-
if (data.data.yExp2) {
559-
data.data.y2 = d.usery2(coords);
560-
data.data.y1 = d.usery(coords);
561-
} else if (data.data.yExp) {
562-
data.data.y2 = d.usery(coords);
563-
}
564-
565-
d.global = {};
566-
Object.assign(d.global, env);
567-
Object.assign(d, data.data);
568-
psgraph[k].call(d, svg);
569-
});
570-
}
571-
});
542+
}
543+
if (k.match(/userline/)) {
544+
plot.forEach((data: any) => {
545+
var d = data.fn.call(data.env, data.match);
546+
data.env.x2 = coords[0];
547+
data.env.y2 = coords[1];
548+
data.data.x2 = data.env.x2;
549+
data.data.y2 = data.env.y2;
550+
551+
if (data.data.xExp2) {
552+
data.data.x2 = d.userx2(coords);
553+
data.data.x1 = d.userx(coords);
554+
} else if (data.data.xExp) {
555+
data.data.x2 = d.userx(coords);
556+
}
557+
558+
if (data.data.yExp2) {
559+
data.data.y2 = d.usery2(coords);
560+
data.data.y1 = d.usery(coords);
561+
} else if (data.data.yExp) {
562+
data.data.y2 = d.usery(coords);
563+
}
564+
565+
d.global = {};
566+
Object.assign(d.global, env);
567+
Object.assign(d, data.data);
568+
psgraph[k].call(d, svg);
569+
});
570+
}
571+
});
572572
}
573573

574574
this.plot.rput.forEach((rput: any) => {

0 commit comments

Comments
 (0)