adds "extraColumnOffset" for generic parts
This commit is contained in:
parent
1441129355
commit
dad3e89577
@ -48,6 +48,7 @@ namespace pxsim {
|
|||||||
width: number,
|
width: number,
|
||||||
height: number,
|
height: number,
|
||||||
pinDist: number,
|
pinDist: number,
|
||||||
|
extraColumnOffset?: number,
|
||||||
firstPin: [number, number],
|
firstPin: [number, number],
|
||||||
}
|
}
|
||||||
export interface PartDefinition {
|
export interface PartDefinition {
|
||||||
@ -294,8 +295,9 @@ namespace pxsim {
|
|||||||
image: "/static/hardware/speaker.svg",
|
image: "/static/hardware/speaker.svg",
|
||||||
width: 500,
|
width: 500,
|
||||||
height: 500,
|
height: 500,
|
||||||
firstPin: [110, 135],
|
firstPin: [180, 135],
|
||||||
pinDist: 70,
|
pinDist: 70,
|
||||||
|
extraColumnOffset: 1,
|
||||||
},
|
},
|
||||||
breadboardColumnsNeeded: 5,
|
breadboardColumnsNeeded: 5,
|
||||||
breadboardStartRow: "f",
|
breadboardStartRow: "f",
|
||||||
|
@ -414,7 +414,8 @@ namespace pxsim.instructions {
|
|||||||
if (cmps) {
|
if (cmps) {
|
||||||
cmps.forEach(cmpInst => {
|
cmps.forEach(cmpInst => {
|
||||||
let cmp = board.addComponent(cmpInst)
|
let cmp = board.addComponent(cmpInst)
|
||||||
let rowCol: BBRowCol = [`${cmpInst.breadboardStartRow}`, `${cmpInst.breadboardStartColumn}`];
|
let colOffset = (<any>cmpInst.visual).breadboardStartColIdx || 0;
|
||||||
|
let rowCol: BBRowCol = [`${cmpInst.breadboardStartRow}`, `${colOffset + cmpInst.breadboardStartColumn}`];
|
||||||
//last step
|
//last step
|
||||||
if (i === step) {
|
if (i === step) {
|
||||||
board.highlightBreadboardPin(rowCol);
|
board.highlightBreadboardPin(rowCol);
|
||||||
|
@ -149,6 +149,7 @@ namespace pxsim.visuals {
|
|||||||
|
|
||||||
public addComponent(cmpDesc: CmpInst): IBoardComponent<any> {
|
public addComponent(cmpDesc: CmpInst): IBoardComponent<any> {
|
||||||
let cmp: IBoardComponent<any> = null;
|
let cmp: IBoardComponent<any> = null;
|
||||||
|
let colOffset = 0;
|
||||||
if (typeof cmpDesc.visual === "string") {
|
if (typeof cmpDesc.visual === "string") {
|
||||||
let builtinVisual = cmpDesc.visual as string;
|
let builtinVisual = cmpDesc.visual as string;
|
||||||
let cnstr = builtinComponentSimVisual[builtinVisual];
|
let cnstr = builtinComponentSimVisual[builtinVisual];
|
||||||
@ -158,13 +159,14 @@ namespace pxsim.visuals {
|
|||||||
} else {
|
} else {
|
||||||
let vis = cmpDesc.visual as PartVisualDefinition;
|
let vis = cmpDesc.visual as PartVisualDefinition;
|
||||||
cmp = new GenericPart(vis);
|
cmp = new GenericPart(vis);
|
||||||
|
colOffset = vis.extraColumnOffset || 0;
|
||||||
}
|
}
|
||||||
this.components.push(cmp);
|
this.components.push(cmp);
|
||||||
this.view.appendChild(cmp.element);
|
this.view.appendChild(cmp.element);
|
||||||
if (cmp.defs)
|
if (cmp.defs)
|
||||||
cmp.defs.forEach(d => this.defs.appendChild(d));
|
cmp.defs.forEach(d => this.defs.appendChild(d));
|
||||||
this.style.textContent += cmp.style || "";
|
this.style.textContent += cmp.style || "";
|
||||||
let rowCol = <BBRowCol>[`${cmpDesc.breadboardStartRow}`, `${cmpDesc.breadboardStartColumn}`];
|
let rowCol = <BBRowCol>[`${cmpDesc.breadboardStartRow}`, `${colOffset + cmpDesc.breadboardStartColumn}`];
|
||||||
let coord = this.getBBCoord(rowCol);
|
let coord = this.getBBCoord(rowCol);
|
||||||
cmp.moveToCoord(coord);
|
cmp.moveToCoord(coord);
|
||||||
let getCmpClass = (type: string) => `sim-${type}-cmp`;
|
let getCmpClass = (type: string) => `sim-${type}-cmp`;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user