Skip to content

Commit

Permalink
Merge branch 'master' into eslint-diff-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonMontealegre committed Feb 6, 2024
2 parents f015e11 + b8b6bfe commit 20c65e1
Show file tree
Hide file tree
Showing 118 changed files with 1,149 additions and 1,238 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/deploy_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,21 @@ jobs:
setup-build-deploy:
name: Setup, Build, and Deploy
runs-on: ubuntu-latest
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: Checkout
uses: actions/checkout@main

- name: Setup GCloud
uses: google-github-actions/setup-gcloud@main
- name: GCloud Auth
uses: google-github-actions/auth@v1
with:
version: '274.0.0'
service_account_email: ${{ secrets.GCP_SA_EMAIL }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true
workload_identity_provider: 'projects/995513074839/locations/global/workloadIdentityPools/github-pool/providers/github-provider'
service_account: 'github-actions@opencircuits-nightly.iam.gserviceaccount.com'

- name: Setup GCloud
uses: google-github-actions/setup-gcloud@v1

- name: Set Node.js 16.x
uses: actions/setup-node@main
Expand Down
8 changes: 0 additions & 8 deletions linting/.core.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,5 @@ module.exports = {
"arrow-body-style": "error",
"arrow-spacing": "error",
"eol-last": "error",

"no-restricted-syntax": [
"error",
{
"selector": "TSEnumDeclaration:not([const=true])",
"message": "Don't declare non-const enums",
},
],
},
}
4 changes: 3 additions & 1 deletion linting/.imports.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ function getSubdirectories(prefix, topDir) {
* @param {string} pattern the new pattern to add
*/
function addPath(pathGroupsIn, pattern) {
if (pattern === "core/rendering/Styles")
return;
pathGroupsIn.push({"pattern": pattern, "group": "external", "position": "after"});
pathGroupsIn.push({"pattern": pattern + "/*", "group": "external", "position": "after"});
}
Expand All @@ -41,7 +43,7 @@ const siteDirectories = ["shared", "analog", "digital", "landing"];
const siteSubDirectories = ["utils", "api", "state", "components", "containers", "tests"];
const pathGroups = [
{"pattern": "react", "group": "external"},
{"pattern": "{**,**/,,./,../,*}{C,c}onstants{**,/**,,*}", "group": "external", "position": "after"},
{"pattern": "{**,**/,,./,../,*}{Constants,constants,core/rendering/Styles}{**,/**,,*}", "group": "external", "position": "after"},
{"pattern": "Vector", "group": "external", "position": "after"},
{"pattern": "math/**", "group": "external", "position": "after"},
{"pattern": "test/helpers/*", "group": "external", "position": "after"},
Expand Down
1 change: 0 additions & 1 deletion src/app/analog/models/AnalogComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export abstract class AnalogComponent extends Component {
super(size, initialProps);

this.ports = new PortSet<AnalogPort>(this, portCount, portPositioner, AnalogPort);
this.props = initialProps;
}

public setDesigner(designer?: AnalogCircuitDesigner): void {
Expand Down
4 changes: 2 additions & 2 deletions src/app/analog/models/eeobjects/essentials/Capacitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class Capacitor extends AnalogComponent {
public constructor() {
super(
new ClampedValue(2),
V(20, 60), new LeftRightPositioner(),
V(0.4, 0.6), new LeftRightPositioner(),
InitialProps,
);
}
Expand All @@ -38,7 +38,7 @@ export class Capacitor extends AnalogComponent {
}

public override getPropInfo(key: string) {
return Info[key];
return Info[key] ?? super.getPropInfo(key);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/app/analog/models/eeobjects/essentials/Ground.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class Ground extends AnalogComponent {
public constructor() {
super(
new ClampedValue(1),
V(60, 30), new SidePositioner("top")
V(1.2, 0.6), new SidePositioner("top")
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/analog/models/eeobjects/essentials/Inductor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class Inductor extends AnalogComponent {
public constructor() {
super(
new ClampedValue(2),
V(40, 240*40/104), new TopBottomPositioner(),
V(0.8, 240*0.8/104), new TopBottomPositioner(),
InitialProps,
);
}
Expand All @@ -38,7 +38,7 @@ export class Inductor extends AnalogComponent {
}

public override getPropInfo(key: string) {
return Info[key];
return Info[key] ?? super.getPropInfo(key);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/app/analog/models/eeobjects/essentials/Resistor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class Resistor extends AnalogComponent {
public constructor() {
super(
new ClampedValue(2),
V(60, 50), new LeftRightPositioner(),
V(1.2, 1), new LeftRightPositioner(),
InitialProps,
);
}
Expand All @@ -38,7 +38,7 @@ export class Resistor extends AnalogComponent {
}

public override getPropInfo(key: string) {
return Info[key];
return Info[key] ?? super.getPropInfo(key);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/app/analog/models/eeobjects/measurement/Oscilloscope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ const [Info, InitialProps] = GenPropInfo({
"size": {
type: "veci",
label: "Display Size",
initial: V(800, 400),
min: V(400, 200),
step: V(100, 100),
initial: V(16, 8),
min: V(8, 4),
step: V(2, 2),
},
},
});
Expand Down Expand Up @@ -80,7 +80,7 @@ export class Oscilloscope extends AnalogComponent {
}

public override getPropInfo(key: string): PropInfo {
return Info[key];
return Info[key] ?? super.getPropInfo(key);
}

public override getDisplayName(): string {
Expand Down
4 changes: 2 additions & 2 deletions src/app/analog/models/eeobjects/other/Label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ export class Label extends AnalogComponent {
public constructor() {
super(
new ClampedValue(0),
V(60, 30), undefined,
V(1.2, 0.6), undefined,
InitialProps,
);
}

public override getPropInfo(key: string): PropInfo {
return Info[key];
return Info[key] ?? super.getPropInfo(key);
}

public override getDisplayName(): string {
Expand Down
4 changes: 2 additions & 2 deletions src/app/analog/models/eeobjects/sources/CurrentSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class CurrentSource extends AnalogComponent {
public constructor() {
super(
new ClampedValue(2),
V(50, 50), new TopBottomPositioner(),
V(1, 1), new TopBottomPositioner(),
InitialProps,
);
}
Expand All @@ -38,7 +38,7 @@ export class CurrentSource extends AnalogComponent {
}

public override getPropInfo(key: string) {
return Info[key];
return Info[key] ?? super.getPropInfo(key);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/app/analog/models/eeobjects/sources/VoltageSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class VoltageSource extends AnalogComponent {
public constructor() {
super(
new ClampedValue(2),
V(50, 50), new TopBottomPositioner(),
V(1, 1), new TopBottomPositioner(),
InitialProps,
);
}
Expand All @@ -101,7 +101,7 @@ export class VoltageSource extends AnalogComponent {
}

public override getPropInfo(key: string) {
return Info[key];
return Info[key] ?? super.getPropInfo(key);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/app/analog/models/ports/positioners/SidePositioner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ export class SidePositioner extends Positioner<AnalogPort> {
: this.side === "right"
? V(1, 0)
: this.side === "top"
? V(0, -1)
: V(0, 1)
? V(0, 1)
: V(0, -1)
);

p1.setOriginPos(dir.scale(size/2));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ export class TopBottomPositioner extends Positioner<AnalogPort> {
public override updatePortPositions([p1, p2]: AnalogPort[]): void {
const height = p1.getParent().getSize().y;

p1.setOriginPos(V(0, -height/2));
p1.setTargetPos(V(0, -(height/2+IO_PORT_LENGTH)));
p1.setOriginPos(V(0, height/2));
p1.setTargetPos(V(0, (height/2+IO_PORT_LENGTH)));

p2.setOriginPos(V(0, height/2));
p2.setTargetPos(V(0, height/2+IO_PORT_LENGTH));
p2.setOriginPos(V(0, -height/2));
p2.setTargetPos(V(0, -(height/2+IO_PORT_LENGTH)));
}

}
2 changes: 1 addition & 1 deletion src/app/analog/rendering/renderers/ComponentRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const ComponentRenderer = (() => {
// TODO: figure out how to get around this
if (object instanceof Label) {
// Calculate size
const width = renderer.getTextWidth(object.getName()) + 20;
const width = renderer.getTextWidth(object.getName()) + 0.4;
object.setSize(V(width, size.y));

drawBox(renderer, object.getTransform(), selected, object.getProp("color") as string);
Expand Down

0 comments on commit 20c65e1

Please sign in to comment.