Update padding and fix wiring order

This commit is contained in:
Sam El-Husseini 2017-12-26 23:19:04 -08:00
parent afaedaa0b2
commit c398a5a133
5 changed files with 11 additions and 11 deletions

View File

@ -12,6 +12,7 @@ namespace pxsim.visuals {
constructor(protected parent: SVGSVGElement, protected globalDefs: SVGDefsElement, protected state: T, protected port: number) { constructor(protected parent: SVGSVGElement, protected globalDefs: SVGDefsElement, protected state: T, protected port: number) {
super(state); super(state);
} }
getInnerWidth(): number { getInnerWidth(): number {
@ -57,7 +58,6 @@ namespace pxsim.visuals {
} }
onComponentVisible() { onComponentVisible() {
} }
} }
} }

View File

@ -153,12 +153,6 @@ namespace pxsim.visuals {
this.contentGroup = svg.elt("g") as SVGGElement; this.contentGroup = svg.elt("g") as SVGGElement;
this.scrollGroup = svg.child(this.contentGroup, "g") as SVGGElement; this.scrollGroup = svg.child(this.contentGroup, "g") as SVGGElement;
// Inject all view containers
for (let i = 0; i < 4; i++) {
this.inputContainers[i].inject(this.scrollGroup);
this.outputContainers[i].inject(this.scrollGroup);
}
this.inputs = []; this.inputs = [];
this.outputs = []; this.outputs = [];
this.inputControls = []; this.inputControls = [];
@ -172,6 +166,12 @@ namespace pxsim.visuals {
this.inputWires[port].inject(this.scrollGroup); this.inputWires[port].inject(this.scrollGroup);
} }
// Inject all view containers
for (let i = 0; i < 4; i++) {
this.inputContainers[i].inject(this.scrollGroup);
this.outputContainers[i].inject(this.scrollGroup);
}
// Inject all ports // Inject all ports
this.setInput(0, new PortView(0, 'A')); this.setInput(0, new PortView(0, 'A'));
this.setInput(1, new PortView(1, 'B')); this.setInput(1, new PortView(1, 'B'));
@ -267,7 +267,7 @@ namespace pxsim.visuals {
currentY = moduleHeight; currentY = moduleHeight;
const wireBrickSpacing = brickWidth / 5; const wireBrickSpacing = brickWidth / 5;
const wiringYPadding = 0; const wiringYPadding = 5;
let wireStartX = 0; let wireStartX = 0;
let wireEndX = brickPadding + wireBrickSpacing; let wireEndX = brickPadding + wireBrickSpacing;
let wireEndY = currentY + this.getWiringHeight() + wiringYPadding; let wireEndY = currentY + this.getWiringHeight() + wiringYPadding;

View File

@ -10,7 +10,7 @@ namespace pxsim.visuals {
} }
public getPaddingRatio() { public getPaddingRatio() {
return 1 / 6; return 1 / 4;
} }
public updateState() { public updateState() {

View File

@ -8,7 +8,7 @@ namespace pxsim.visuals {
} }
public getPaddingRatio() { public getPaddingRatio() {
return 1 / 4; return 0.3;
} }
} }
} }

View File

@ -17,7 +17,7 @@ namespace pxsim.visuals {
} }
public getPaddingRatio() { public getPaddingRatio() {
return 1 / 10; return 1 / 4;
} }
public hasClick() { public hasClick() {