Skip to content

Commit

Permalink
Merge pull request #45 from andymac-2/feature-curves
Browse files Browse the repository at this point in the history
Feature curves
  • Loading branch information
andymac-2 authored May 13, 2018
2 parents 9ee6306 + b2cc24d commit 285906d
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 18 deletions.
1 change: 0 additions & 1 deletion src/draw/.#menu.js

This file was deleted.

12 changes: 12 additions & 0 deletions src/draw/lines.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ Draw.quadrupleAngledLine = function (start, end, hspace, vspace, lnClass, parent
"H" + end.x
}, parent);
};
// create an s shaped curve, going to the right of the start and into the left of end.
// strength indicates how curved the line will be
Draw.sLine = function (start, end, strength, lnClass, parent) {
return Draw.svgElem ("path", {
"class": lnClass,
"d" : "M" + start.x + " " + start.y + " " +
"C" + (start.x + strength) + " " + start.y + " " +
(end.x - strength) + " " + end.y + " " +
end.x + " " + end.y
}, parent);
};

Draw.doubleAngledLine = function (start, end, hspace, vspace, lnClass, parent){
/* Creates an angled line like so:
end
Expand Down
37 changes: 31 additions & 6 deletions src/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,42 @@ Loader.PAGESIZES = [
{height: 594, width: 841},
{height: 420, width: 594},
{height: 297, width: 420},
{height: 210, width: 297}
{height: 210, width: 297},
{width: 1682, height: 2378},
{width: 1189, height: 1682},
{width: 841, height: 1189},
{width: 594, height: 841},
{width: 420, height: 594},
{width: 297, height: 420},
{width: 210, height: 297},
].map(elem => {
return {
height: elem.height - Loader.PAGEMARGIN * 2,
width: elem.width - Loader.PAGEMARGIN * 2,
};
if (elem.width > elem.height) {
return {
height: elem.height - Loader.PAGEMARGIN * 2,
width: elem.width - Loader.PAGEMARGIN * 2,
};
}
else {
return elem;
}
});
Loader.A3SIZE = Loader.PAGESIZES[5];
// correspond to Loader.PAGESIZES
Loader.PAGESIZENAMES = [
"4A0", "2A0", "A0", "A1", "A2", "A3", "A4"
"4A0 Landscape",
"2A0 Landscape",
"A0 Landscape",
"A1 Landscape",
"A2 Landscape",
"A3 Landscape",
"A4 Landscape",
"4A0 Portrait",
"2A0 Portrait",
"A0 Portrait",
"A1 Portrait",
"A2 Portrait",
"A3 Portrait",
"A4 Portrait",
];
Loader.prototype.printSizeSelector = function (attrs, parent) {
var onchange = (evt) => {
Expand Down
8 changes: 4 additions & 4 deletions src/milestoneMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ MilestoneMap.prototype.reportSelectors = function () {

var entries = this.reports.map (report => report.getMenuText());
Draw.dropDownSegment (
"Current:", this.modifyCurrReport.bind(this), entries, attrs, parent);
"Current:", this.modifyCurrReportEvt.bind(this), entries, attrs, parent);
Draw.dropDownSegment (
"Baseline:", this.modifyCmpReport.bind(this), entries, attrs, parent);
"Baseline:", this.modifyCmpReportEvt.bind(this), entries, attrs, parent);
};

MilestoneMap.prototype.draw = function () {
Expand Down Expand Up @@ -516,11 +516,11 @@ MilestoneMap.prototype.modifyEndDate = function (e, input) {
};


MilestoneMap.prototype.modifyCurrReport = function (evt) {
MilestoneMap.prototype.modifyCurrReportEvt = function (evt) {
this.modifyCurrReport (evt.currentTarget.value);
this.draw ();
};
MilestoneMap.prototype.modifyCmpReport = function (evt) {
MilestoneMap.prototype.modifyCmpReportEvt = function (evt) {
this.modifyCmpReport (evt.currentTarget.value);
this.draw ();
};
17 changes: 10 additions & 7 deletions src/milestoneMap/dependency.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,20 @@ Dependency.prototype.draw = function () {
}

var start = Draw.getElemXY(this.dependency.elem);
start.x += MsAtReport.DIAMONDSIZE;
//start.x += MsAtReport.DIAMONDSIZE;
var end = Draw.getElemXY(this.dependent.elem);
end.x -= MsAtReport.DIAMONDSIZE;

Draw.quadrupleAngledLine (
start, end, Dependency.HSPACE, Dependency.VSPACE, "dependencyLine",
this.elem);
// Draw.quadrupleAngledLine (
// start, end, Dependency.HSPACE, Dependency.VSPACE, "dependencyLine",
// this.elem);

Draw.quadrupleAngledLine (
start, end, Dependency.HSPACE, Dependency.VSPACE, "thick transparentLine",
this.elem);
// Draw.quadrupleAngledLine (
// start, end, Dependency.HSPACE, Dependency.VSPACE, "thick transparentLine",
// this.elem);

Draw.sLine (start, end, 150, "dependencyLine", this.elem);
Draw.sLine (start, end, 150, "thick transparentLine", this.elem);

Draw.svgElem ("path", {
"class": "dependencyArrow",
Expand Down
6 changes: 6 additions & 0 deletions src/milestoneMap/msAtReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,9 @@ MsAtReport.prototype.removeDependent = function (dependent) {
// events
MsAtReport.prototype.diamondOnClick = function () {
if (this.mMap.globalMode === MilestoneMap.CREATEDEPENDENCY) {
if (this.isBusinessMs()) {
return;
};
var dep = this.mMap.addDependency ({
"report": this.mMap.currReport.index,
"dependency": this.mMap.globalData,
Expand Down Expand Up @@ -311,6 +314,9 @@ MsAtReport.prototype.deleteDraw = function () {
this.reflowUp ();
};
MsAtReport.prototype.createDependency = function () {
if (this.isBusinessMs()) {
return;
}
this.mMap.globalMode = MilestoneMap.CREATEDEPENDENCY;
this.mMap.globalData = this.milestone.index;
this.mMap.globalModeSet = true;
Expand Down

0 comments on commit 285906d

Please sign in to comment.