Skip to content

Commit

Permalink
Merge pull request frg-fossee#161 from frg-fossee/ArduinoFrontend
Browse files Browse the repository at this point in the history
Bug Fixes
  • Loading branch information
NavonilDas authored Jul 3, 2020
2 parents 3ab21dd + ac8e429 commit 2812462
Show file tree
Hide file tree
Showing 9 changed files with 21,828 additions and 270 deletions.
619 changes: 357 additions & 262 deletions ArduinoFrontend/package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions ArduinoFrontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "arduino-frontend",
"version": "0.0.0",
"version": "0.8.0",
"scripts": {
"ng": "ng",
"start": "ng serve --disableHostCheck",
Expand Down Expand Up @@ -31,14 +31,15 @@
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.13.0",
"@angular-devkit/build-angular": "^0.13.10",
"@angular/cli": "~7.3.8",
"@angular/compiler-cli": "~7.2.0",
"@angular/language-service": "~7.2.0",
"@compodoc/compodoc": "^1.1.11",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^8.9.5",
"avr8js": "^0.9.1",
"codelyzer": "~4.5.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
Expand Down
2 changes: 1 addition & 1 deletion ArduinoFrontend/src/app/Libs/Download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class Download {
// Return a new Promise
return new Promise((res, _) => {
// Get the client pixel ratio
const pixelRatio = window.devicePixelRatio || 1;
const pixelRatio = 1.25;
// get The Bounding box of the circuit
const gtag = (document.querySelector('#holder > svg > g') as SVGSVGElement).getBBox();
if (gtag.width === 0 || gtag.height === 0) {
Expand Down
38 changes: 34 additions & 4 deletions ArduinoFrontend/src/app/Libs/Workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -707,20 +707,44 @@ export class Workspace {

// get the component id
const uid = window.Selected.id;
const key = window.Selected.keyName;

// If Current Selected item is a Wire which is not Connected from both end
if (key === 'wires') {
if (isNull(window.Selected.end)) {
// Remove and deselect
window.Selected.remove();
window.Selected = null;
window.isSelected = false;
}
}

// get the component keyname
const items = window.scope[window.Selected.keyName];
const items = window.scope[key];
// Use linear search find the element
for (let i = 0; i < items.length; ++i) {
if (items[i].id === uid) {
// remove from DOM
window.Selected.remove();

window.Selected = null;
window.isSelected = false;
// Remove from scope
const k = items.splice(i, 1);
// Remove data from it recursively
Workspace.removeMeta(k[0]);

if (key !== 'wires') {
let index = 0;
while (index < window.scope.wires.length) {
const wire = window.scope.wires[index];
if (isNull(wire.start) && isNull(wire.end)) {
window.scope.wires.splice(index, 1);
continue;
}
++index;
}
}

break;
}
}
Expand Down Expand Up @@ -811,6 +835,7 @@ export class Workspace {
api.getHex(taskid).subscribe(hex => {
if (hex.state === 'SUCCESS' && !hex.details.error) {
clearInterval(temp);
let SUCCESS = true;
for (const k in hex.details) {
if (hex.details[k]) {
const d = hex.details[k];
Expand All @@ -820,11 +845,14 @@ export class Workspace {
nameMap[k].hex = d.data;
}
if (d.error) {
SUCCESS = false;
window.printConsole(d.error, ConsoleType.ERROR);
}
}
}
Workspace.startArduino();
if (SUCCESS) {
Workspace.startArduino();
}
callback();
} else if (hex.state === 'FAILED' || hex.details.error) {
clearInterval(temp);
Expand Down Expand Up @@ -855,7 +883,7 @@ export class Workspace {
}
}
// Sequence to be followed while calling initSimulation
const seqn = ['output', 'controllers', 'drivers', 'general', 'power', 'input', 'misc'];
const seqn = ['output', 'general', 'controllers', 'drivers', 'power', 'input', 'misc'];
// For each component call initsimulation function
for (const key of seqn) {
for (const items of Utils.componentBox[key]) {
Expand Down Expand Up @@ -948,6 +976,8 @@ export class Workspace {
window.isSelected = false;
// Reinitialize variables
Workspace.initalizeGlobalVariables(window['canvas']);
// Hide Property box
window.hideProperties();
// Hide Loading animation
window.hideLoading();
}
Expand Down
Loading

0 comments on commit 2812462

Please sign in to comment.