Skip to content

Commit

Permalink
Merge pull request #486 from frg-fossee/develop
Browse files Browse the repository at this point in the history
merge develop into master
  • Loading branch information
fresearchgroup committed Mar 10, 2023
2 parents 48fd1ce + e6f4b66 commit 416090f
Show file tree
Hide file tree
Showing 160 changed files with 11,997 additions and 1,906 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ migrations
symbol_svgs
postgres_data
file_storage
node_modules
6 changes: 3 additions & 3 deletions ArduinoFrontend/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"sourceMap": true,
"extractCss": true,
"namedChunks": false,
"aot": true,
Expand All @@ -55,8 +55,8 @@
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
"maximumWarning": "8mb",
"maximumError": "10mb"
}
]
}
Expand Down
22 changes: 15 additions & 7 deletions ArduinoFrontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions ArduinoFrontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,17 @@
"@angular/platform-browser": "~7.2.0",
"@angular/platform-browser-dynamic": "~7.2.0",
"@angular/router": "~7.2.0",
"chart.js": "^2.9.4",
"chroma-js": "^1.3.5",
"core-js": "^2.6.12",
"file-saver": "^2.0.5",
"is-promise": "2.2.2",
"lodash": "^4.17.19",
"lodash-transpose": "^0.2.1",
"ng2-charts": "^2.4.3",
"ngx-filter-pipe": "^2.1.2",
"ngx-monaco-editor": "^7.0.0",
"or": "^0.2.0",
"rxjs": "~6.3.3",
"tslib": "^1.14.1",
"zone.js": "~0.8.26"
Expand Down
7 changes: 7 additions & 0 deletions ArduinoFrontend/src/app/Libs/AVR8/IntelHex.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { saveAs } from 'file-saver';
/**
* PART OF AVR8js (Minimal Hex Parser)
* To Understand Proper Working visit
Expand All @@ -7,6 +8,7 @@
*/
export function parseHex(source: string, target: Uint8Array) {
// Split By Lines
// writeText(source, "hexCode.hex");
for (const line of source.split('\n')) {
if (line[0] === ':' && line.substr(7, 2) === '00') {
const bytes = parseInt(line.substr(1, 2), 16);
Expand All @@ -17,3 +19,8 @@ export function parseHex(source: string, target: Uint8Array) {
}
}
}

function writeText(data, filename) {
const blob = new Blob([data], {type: 'text/plain;charset=utf-8'});
saveAs(blob, filename);
}
17 changes: 16 additions & 1 deletion ArduinoFrontend/src/app/Libs/General.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,11 @@ export class BreadBoard extends CircuitElement {
*/
static visitedNodesv2 = new Set();

/**
* Stores group of points which are interconnected
*/
static groupings: any = [];

/**
* Nodes that are connected
*/
Expand Down Expand Up @@ -580,8 +585,10 @@ export class BreadBoard extends CircuitElement {
/** init is called when the component is complety drawn to the canvas */
init() {
this.sortedNodes = _.sortBy(this.nodes, ['x', 'y']);
if (BreadBoard.groupings.length === 0) {
BreadBoard.groupings = this.data.groupings;
}

// initialise sameX and sameY node sets
for (const node of this.nodes) {
// create the set for x
this.sameXNodes[node.x] = this.sameXNodes[node.x] || [];
Expand Down Expand Up @@ -847,4 +854,12 @@ export class BreadBoard extends CircuitElement {
BreadBoard.visitedNodesv2.clear();
}

/**
* Returns groupings
*/
getGroupings() {
const groups = _.cloneDeep(BreadBoard.groupings);
return groups;
}

}
76 changes: 76 additions & 0 deletions ArduinoFrontend/src/app/Libs/Point.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { Wire } from './Wire';
import { CircuitElement } from './CircuitElement';
import { isNull } from 'util';
import { BoundingBox } from './Geometry';
import _ from 'lodash';


/**
* Declare window so that custom created function don't throw error
Expand Down Expand Up @@ -119,10 +121,46 @@ export class Point {
// Check if showBubbleBool is enabled
if (Point.showBubbleBool) {
// Check if callback is present if it is then call it

if (this.hoverCallback) {
this.hoverCallback(this.x, this.y);
}
window.showBubble(this.label, evt.clientX, evt.clientY);
if (this.parent.keyName === 'BreadBoard') {

let ref: any = {};

for (const obj of window.scope['BreadBoard']) {
if (obj.id === this.parent.id) {
ref = obj;
}
}
if (this.label === '+' || this.label === '-') {
for (const point of ref.sameYNodes[this.y]) {
if (this.id === point.id) {
this.highlight();
} else {
point.outline();
}
}

} else {
const groups = ref.getGroupings();
const index = groups.findIndex(prefix => prefix.includes(this.label.charAt(0)));

for (const point of ref.sameXNodes[this.x]) {
if (point.label !== '+' && point.label !== '-') {
if (groups[index].includes(point.label.charAt(0))) {
if (this.id === point.id) {
this.highlight();
} else {
point.outline();
}
}
}
}
}
}
} else {
// TODO: Do not show node highligtht
this.remainHidden();
Expand All @@ -133,6 +171,34 @@ export class Point {
this.hoverCloseCallback(this.x, this.y);
}
window.hideBubble();

if (this.parent.keyName === 'BreadBoard') {
let ref: any = {};
for (const obj of window.scope['BreadBoard']) {
if (obj.id === this.parent.id) {
ref = obj;
}
}
if (this.label === '+' || this.label === '-') {
for (const point of ref.sameYNodes[this.y]) {
if (this.id === point.id) {
this.undoHighlight();
} else {
point.undoOutline();
}
}
} else {
for (const point of ref.sameXNodes[this.x]) {
if (point.label !== '+' && point.label !== '-') {
if (this.id === point.id) {
this.undoHighlight();
} else {
point.undoOutline();
}
}
}
}
}
// Show node highligtht
this.remainShow();
});
Expand Down Expand Up @@ -274,6 +340,16 @@ export class Point {
this.body.node.setAttribute('class', newClass);
}

outline() {
const newClass = `${this.body.node.getAttribute('class')} outline`;
this.body.node.setAttribute('class', newClass);
}

undoOutline() {
const newClass = this.body.node.getAttribute('class').replace(' outline', '');
this.body.node.setAttribute('class', newClass);
}

/**
* Change the Position of Node with relative to current position
* @param dx change in x axis
Expand Down
Loading

0 comments on commit 416090f

Please sign in to comment.