From 1bce4de22888eb4b37b17f3a118065012331267e Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Thu, 26 Jan 2017 22:04:26 +0100 Subject: Set first tick to be 1 instead of 0 --- src/scripts/controllers/simulation/timeline.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/scripts/controllers/simulation/timeline.ts') diff --git a/src/scripts/controllers/simulation/timeline.ts b/src/scripts/controllers/simulation/timeline.ts index a558afe1..950973a9 100644 --- a/src/scripts/controllers/simulation/timeline.ts +++ b/src/scripts/controllers/simulation/timeline.ts @@ -153,9 +153,9 @@ export class TimelineController { let correction = 0; if (this.timeUnitFraction * this.timelineWidth > this.timeMarkerWidth) { correction = (this.timeUnitFraction * this.timelineWidth - this.timeMarkerWidth) * - (tick / this.simulationController.lastSimulatedTick); + ((tick - 1) / this.simulationController.lastSimulatedTick); } - return (100 * (this.timeUnitFraction * tick + correction / this.timelineWidth)) + "%"; + return (100 * (this.timeUnitFraction * (tick - 1) + correction / this.timelineWidth)) + "%"; } -} \ No newline at end of file +} -- cgit v1.2.3 From 027b379cf9d53a12782781e586f79051461ab661 Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Thu, 26 Jan 2017 23:11:29 +0100 Subject: Refactor controllers to use 'const' when possible --- src/scripts/controllers/simulation/timeline.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/scripts/controllers/simulation/timeline.ts') diff --git a/src/scripts/controllers/simulation/timeline.ts b/src/scripts/controllers/simulation/timeline.ts index 950973a9..ec3d8cb4 100644 --- a/src/scripts/controllers/simulation/timeline.ts +++ b/src/scripts/controllers/simulation/timeline.ts @@ -45,8 +45,8 @@ export class TimelineController { }); $(".timeline-container .timeline").on("click", (event: JQueryEventObject) => { - let parentOffset = $(event.target).closest(".timeline").offset(); - let clickX = event.pageX - parentOffset.left; + const parentOffset = $(event.target).closest(".timeline").offset(); + const clickX = event.pageX - parentOffset.left; let newTick = Math.round(clickX / (this.timelineWidth * this.timeUnitFraction)); @@ -111,7 +111,7 @@ export class TimelineController { private updateTaskIndicators(): void { $(".task-indicator").remove(); - let tickStateTypes = { + const tickStateTypes = { "queueEntryTick": "task-queued", "startTick": "task-started", "finishedTick": "task-finished" @@ -121,7 +121,7 @@ export class TimelineController { return; } - let indicatorCountList = new Array(this.simulationController.stateCache.lastCachedTick); + const indicatorCountList = new Array(this.simulationController.stateCache.lastCachedTick); let indicator; this.simulationController.currentExperiment.trace.tasks.forEach((task: ITask) => { for (let tickStateType in tickStateTypes) { -- cgit v1.2.3