From b0d29ef373627cb72c6f889353974a26a7b584e3 Mon Sep 17 00:00:00 2001 From: jp3wi Date: Thu, 2 Nov 2023 22:36:59 -0400 Subject: [PATCH 1/4] Fixed Decimal Places and Right-Click Menu --- .../edit-panel/edit-panel.component.ts | 14 +++--- .../component/new-grid/new-grid.component.ts | 46 +++++++++---------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/app/component/edit-panel/edit-panel.component.ts b/src/app/component/edit-panel/edit-panel.component.ts index e175224..44576e2 100644 --- a/src/app/component/edit-panel/edit-panel.component.ts +++ b/src/app/component/edit-panel/edit-panel.component.ts @@ -194,7 +194,7 @@ export class EditPanelComponent implements OnInit, AfterContentInit, OnDestroy { this.settingsService.lengthUnit.getValue() ); if (!success) { - this.jointForm.patchValue({ xPos: this.activeSrv.selectedJoint.x.toFixed(2).toString() }); + this.jointForm.patchValue({ xPos: this.activeSrv.selectedJoint.x.toFixed(3).toString() }); } else { this.activeSrv.selectedJoint.x = value; this.gridUtils.dragJoint( @@ -220,7 +220,7 @@ export class EditPanelComponent implements OnInit, AfterContentInit, OnDestroy { this.settingsService.lengthUnit.getValue() ); if (!success) { - this.jointForm.patchValue({ yPos: this.activeSrv.selectedJoint.y.toFixed(2).toString() }); + this.jointForm.patchValue({ yPos: this.activeSrv.selectedJoint.y.toFixed(3).toString() }); } else { this.activeSrv.selectedJoint.y = value; this.gridUtils.dragJoint( @@ -343,7 +343,7 @@ export class EditPanelComponent implements OnInit, AfterContentInit, OnDestroy { ); if (!success) { this.linkForm.patchValue({ - length: this.activeSrv.selectedLink.length.toFixed(2).toString(), + length: this.activeSrv.selectedLink.length.toFixed(3).toString(), }); } else { this.activeSrv.selectedLink.length = value; @@ -406,7 +406,7 @@ export class EditPanelComponent implements OnInit, AfterContentInit, OnDestroy { ); if (!success) { this.forceForm.patchValue({ - magnitude: this.activeSrv.selectedForce.mag.toFixed(2).toString(), + magnitude: this.activeSrv.selectedForce.mag.toFixed(3).toString(), }); } else { this.activeSrv.selectedForce.mag = value; @@ -433,7 +433,7 @@ export class EditPanelComponent implements OnInit, AfterContentInit, OnDestroy { ); if (!success) { this.forceForm.patchValue({ - angle: this.activeSrv.selectedForce.angleRad.toFixed(2).toString(), + angle: this.activeSrv.selectedForce.angleRad.toFixed(3).toString(), }); } else { //Always convert to Radian since Force.angle is in Radian @@ -463,7 +463,7 @@ export class EditPanelComponent implements OnInit, AfterContentInit, OnDestroy { ); if (!success) { this.forceForm.patchValue({ - xComp: this.activeSrv.selectedForce.xComp.toFixed(2).toString(), + xComp: this.activeSrv.selectedForce.xComp.toFixed(3).toString(), }); } else { this.activeSrv.selectedForce.xComp = value; @@ -487,7 +487,7 @@ export class EditPanelComponent implements OnInit, AfterContentInit, OnDestroy { ); if (!success) { this.forceForm.patchValue({ - yComp: this.activeSrv.selectedForce.yComp.toFixed(2).toString(), + yComp: this.activeSrv.selectedForce.yComp.toFixed(3).toString(), }); } else { this.activeSrv.selectedForce.yComp = value; diff --git a/src/app/component/new-grid/new-grid.component.ts b/src/app/component/new-grid/new-grid.component.ts index cada759..695e240 100644 --- a/src/app/component/new-grid/new-grid.component.ts +++ b/src/app/component/new-grid/new-grid.component.ts @@ -250,13 +250,6 @@ export class NewGridComponent { // console.log(this.lastRightClick.constructor.name); switch (this.lastRightClick.constructor.name) { case 'Force': - this.cMenuItems.push( - new cMenuItem( - 'Delete Force', - this.mechanismSrv.deleteForce.bind(this.mechanismSrv), - 'remove' - ) - ); //Switch force direction, switch force local, delete Force this.cMenuItems.push( new cMenuItem( @@ -272,21 +265,21 @@ export class NewGridComponent { 'switch_force_dir' ) ); + this.cMenuItems.push( + new cMenuItem( + 'Delete Force', + this.mechanismSrv.deleteForce.bind(this.mechanismSrv), + 'remove' + ) + ); break; case 'RealLink': - //Delete Link, Attach Link, Attach Tracer Point, Attach Joint + //Attach Link, Attach Tracer Point, Attach Joint, Delete Link //Don't give options if a fillet it selected and not a primary link let weldedLinkFilletSelected = (this.lastRightClick as RealLink).isWelded && (this.lastRightClick as RealLink).lastSelectedSublink == null; - this.cMenuItems.push( - new cMenuItem( - 'Delete Link', - this.mechanismSrv.deleteLink.bind(this.mechanismSrv), - 'remove' - ) - ); this.cMenuItems.push( new cMenuItem( 'Attach Link', @@ -311,6 +304,13 @@ export class NewGridComponent { weldedLinkFilletSelected || !this.settings.isForces.value ) ); + this.cMenuItems.push( + new cMenuItem( + 'Delete Link', + this.mechanismSrv.deleteLink.bind(this.mechanismSrv), + 'remove' + ) + ); break; case 'RevJoint': let jointIsSlider = this.gridUtils.isAttachedToSlider(this.lastRightClick); @@ -321,14 +321,6 @@ export class NewGridComponent { let canTogglePath = !(this.lastRightClick as RealJoint).ground && this.mechanismSrv.oneValidMechanismExists(); - this.cMenuItems.push( - new cMenuItem( - 'Delete Joint', - this.mechanismSrv.deleteJoint.bind(this.mechanismSrv), - 'remove' - ) - ); - this.cMenuItems.push( new cMenuItem('Attach Link', this.startCreatingLink.bind(this), 'new_link') ); @@ -392,6 +384,14 @@ export class NewGridComponent { // !canTogglePath // ) // ); //Rev Joint - Not Ground and at least one valid mechanism exists + + this.cMenuItems.push( + new cMenuItem( + 'Delete Joint', + this.mechanismSrv.deleteJoint.bind(this.mechanismSrv), + 'remove' + ) + ); break; case 'String': //This means grid From 2490d15163510d523f955191119398dfed7d7957 Mon Sep 17 00:00:00 2001 From: jp3wi Date: Thu, 9 Nov 2023 22:24:52 -0500 Subject: [PATCH 2/4] Made changes to decimal places (#151) and updated slider icons (#167) --- .../component/edit-panel/edit-panel.component.ts | 14 +++++++------- src/app/services/number-unit-parser.service.ts | 12 ++++++------ src/assets/icons/add_slider.svg | 9 +++++---- src/assets/icons/add_slider_old.svg | 12 ++++++++++++ src/assets/icons/remove_slider.svg | 9 +++++---- src/assets/icons/remove_slider_old.svg | 12 ++++++++++++ 6 files changed, 47 insertions(+), 21 deletions(-) create mode 100644 src/assets/icons/add_slider_old.svg create mode 100644 src/assets/icons/remove_slider_old.svg diff --git a/src/app/component/edit-panel/edit-panel.component.ts b/src/app/component/edit-panel/edit-panel.component.ts index 44576e2..4340cd0 100644 --- a/src/app/component/edit-panel/edit-panel.component.ts +++ b/src/app/component/edit-panel/edit-panel.component.ts @@ -194,7 +194,7 @@ export class EditPanelComponent implements OnInit, AfterContentInit, OnDestroy { this.settingsService.lengthUnit.getValue() ); if (!success) { - this.jointForm.patchValue({ xPos: this.activeSrv.selectedJoint.x.toFixed(3).toString() }); + this.jointForm.patchValue({ xPos: this.activeSrv.selectedJoint.x.toFixed(4).toString() }); } else { this.activeSrv.selectedJoint.x = value; this.gridUtils.dragJoint( @@ -220,7 +220,7 @@ export class EditPanelComponent implements OnInit, AfterContentInit, OnDestroy { this.settingsService.lengthUnit.getValue() ); if (!success) { - this.jointForm.patchValue({ yPos: this.activeSrv.selectedJoint.y.toFixed(3).toString() }); + this.jointForm.patchValue({ yPos: this.activeSrv.selectedJoint.y.toFixed(4).toString() }); } else { this.activeSrv.selectedJoint.y = value; this.gridUtils.dragJoint( @@ -343,7 +343,7 @@ export class EditPanelComponent implements OnInit, AfterContentInit, OnDestroy { ); if (!success) { this.linkForm.patchValue({ - length: this.activeSrv.selectedLink.length.toFixed(3).toString(), + length: this.activeSrv.selectedLink.length.toFixed(4).toString(), }); } else { this.activeSrv.selectedLink.length = value; @@ -406,7 +406,7 @@ export class EditPanelComponent implements OnInit, AfterContentInit, OnDestroy { ); if (!success) { this.forceForm.patchValue({ - magnitude: this.activeSrv.selectedForce.mag.toFixed(3).toString(), + magnitude: this.activeSrv.selectedForce.mag.toFixed(4).toString(), }); } else { this.activeSrv.selectedForce.mag = value; @@ -433,7 +433,7 @@ export class EditPanelComponent implements OnInit, AfterContentInit, OnDestroy { ); if (!success) { this.forceForm.patchValue({ - angle: this.activeSrv.selectedForce.angleRad.toFixed(3).toString(), + angle: this.activeSrv.selectedForce.angleRad.toFixed(4).toString(), }); } else { //Always convert to Radian since Force.angle is in Radian @@ -463,7 +463,7 @@ export class EditPanelComponent implements OnInit, AfterContentInit, OnDestroy { ); if (!success) { this.forceForm.patchValue({ - xComp: this.activeSrv.selectedForce.xComp.toFixed(3).toString(), + xComp: this.activeSrv.selectedForce.xComp.toFixed(4).toString(), }); } else { this.activeSrv.selectedForce.xComp = value; @@ -487,7 +487,7 @@ export class EditPanelComponent implements OnInit, AfterContentInit, OnDestroy { ); if (!success) { this.forceForm.patchValue({ - yComp: this.activeSrv.selectedForce.yComp.toFixed(3).toString(), + yComp: this.activeSrv.selectedForce.yComp.toFixed(4).toString(), }); } else { this.activeSrv.selectedForce.yComp = value; diff --git a/src/app/services/number-unit-parser.service.ts b/src/app/services/number-unit-parser.service.ts index fd91c66..06cfd8a 100644 --- a/src/app/services/number-unit-parser.service.ts +++ b/src/app/services/number-unit-parser.service.ts @@ -10,19 +10,19 @@ export class NumberUnitParserService { public formatValueAndUnit(value: number, units: LengthUnit | AngleUnit | ForceUnit): string { switch (units) { case LengthUnit.CM: - return value.toFixed(2) + ' cm'; + return value.toFixed(4) + ' cm'; case LengthUnit.METER: - return value.toFixed(2) + ' m'; + return value.toFixed(4) + ' m'; case LengthUnit.INCH: - return value.toFixed(2) + ' in'; + return value.toFixed(4) + ' in'; case AngleUnit.DEGREE: return value.toFixed(0) + ' deg'; case AngleUnit.RADIAN: - return value.toFixed(2) + ' rad'; + return value.toFixed(4) + ' rad'; case ForceUnit.LBF: - return value.toFixed(2) + ' lbf'; + return value.toFixed(4) + ' lbf'; case ForceUnit.NEWTON: - return value.toFixed(2) + ' N'; + return value.toFixed(4) + ' N'; } return 'Error in formatValueAndUnit()'; } diff --git a/src/assets/icons/add_slider.svg b/src/assets/icons/add_slider.svg index 893b346..dd214da 100644 --- a/src/assets/icons/add_slider.svg +++ b/src/assets/icons/add_slider.svg @@ -1,11 +1,12 @@ - - - + + + + - + diff --git a/src/assets/icons/add_slider_old.svg b/src/assets/icons/add_slider_old.svg new file mode 100644 index 0000000..893b346 --- /dev/null +++ b/src/assets/icons/add_slider_old.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/assets/icons/remove_slider.svg b/src/assets/icons/remove_slider.svg index d2f501b..51b380a 100644 --- a/src/assets/icons/remove_slider.svg +++ b/src/assets/icons/remove_slider.svg @@ -1,11 +1,12 @@ - - - + + + + - + diff --git a/src/assets/icons/remove_slider_old.svg b/src/assets/icons/remove_slider_old.svg new file mode 100644 index 0000000..d2f501b --- /dev/null +++ b/src/assets/icons/remove_slider_old.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + From b43f5ad39aa8d2957a7ff6e65fc4b51c11559f0a Mon Sep 17 00:00:00 2001 From: jp3wi Date: Fri, 17 Nov 2023 10:44:48 -0500 Subject: [PATCH 3/4] Fixed Length Icon --- src/app/component/edit-panel/edit-panel.component.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/component/edit-panel/edit-panel.component.html b/src/app/component/edit-panel/edit-panel.component.html index ec527ac..c2b0e14 100644 --- a/src/app/component/edit-panel/edit-panel.component.html +++ b/src/app/component/edit-panel/edit-panel.component.html @@ -121,7 +121,7 @@ (closed)="sectionExpanded['JDistToJ'] = false">
- Date: Fri, 24 Nov 2023 19:02:24 -0500 Subject: [PATCH 4/4] Made changes to tutorial, as well as implemented button to re-enable tutorial --- src/app/component/new-grid/new-grid.component.ts | 9 +++------ .../component/right-panel/right-panel.component.html | 2 +- .../component/right-panel/right-panel.component.ts | 11 +++++++---- src/app/component/toolbar/toolbar.component.ts | 4 ++++ 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/app/component/new-grid/new-grid.component.ts b/src/app/component/new-grid/new-grid.component.ts index 695e240..14650c4 100644 --- a/src/app/component/new-grid/new-grid.component.ts +++ b/src/app/component/new-grid/new-grid.component.ts @@ -145,7 +145,7 @@ export class NewGridComponent { .setOptions({ steps: [ { - title: '👋 Welcome', + title: 'Welcome!', intro: 'Let us show you around Planar Mechanism Kinematic Simulator Plus!', }, { @@ -165,13 +165,10 @@ export class NewGridComponent { element: document.querySelector('#helpButton') as HTMLElement, intro: 'If you get stuck at any point, click here for help.', }, - { - element: document.querySelector('#templatesButton') as HTMLElement, - title: "🙌 That's it!", - intro: 'Get started by opening an example linkage!', - }, ], dontShowAgain: true, + showProgress: true, + disableInteraction: true, }) .start(); }); diff --git a/src/app/component/right-panel/right-panel.component.html b/src/app/component/right-panel/right-panel.component.html index c222a27..944c558 100644 --- a/src/app/component/right-panel/right-panel.component.html +++ b/src/app/component/right-panel/right-panel.component.html @@ -15,7 +15,7 @@ Help
Tutorial Videos - + Restart Tutorial (Refresh Required) PMKS+ is open source! Do you want to help us develop it? Github Repo
diff --git a/src/app/component/right-panel/right-panel.component.ts b/src/app/component/right-panel/right-panel.component.ts index 06afbbd..8695c43 100644 --- a/src/app/component/right-panel/right-panel.component.ts +++ b/src/app/component/right-panel/right-panel.component.ts @@ -109,6 +109,11 @@ export class RightPanelComponent { // console.warn(this.isOpen); } + static closeOpenTab() { + if(this.isOpen) + this.isOpen = false; + } + getOpenTab() { return RightPanelComponent.openTab; } @@ -277,10 +282,8 @@ export class RightPanelComponent { logEvent(this.analytics, 'goto_github'); } - sendNotReady() { - introJs().start(); - // NewGridComponent.sendNotification('Sorry, the tutorial is not ready yet.'); - // logEvent(this.analytics, 'tutorial_not_ready'); + resetTutorial() { + introJs().setDontShowAgain(false); } getBrowserName() { diff --git a/src/app/component/toolbar/toolbar.component.ts b/src/app/component/toolbar/toolbar.component.ts index 1925bdd..e07652c 100644 --- a/src/app/component/toolbar/toolbar.component.ts +++ b/src/app/component/toolbar/toolbar.component.ts @@ -83,6 +83,10 @@ export class ToolbarComponent implements OnInit, AfterViewInit { RightPanelComponent.tabClicked(4); } + closeRightPanelTab() { + RightPanelComponent.closeOpenTab(); + } + animate: boolean = false; // static inputAngularVelocity: number = 10;