Skip to content

Commit 3f893a0

Browse files
committed
Add more comments, minor fixes
1 parent a1ff6a4 commit 3f893a0

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

InterSpec_resources/D3TimeChart.js

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ ValidationError = function (message, fileName, lineNumber) {
2929
Object.setPrototypeOf(instance, Object.getPrototypeOf(this));
3030
return instance;
3131
};
32+
3233
ValidationError.prototype = Object.create(Error.prototype, {
3334
constructor: {
3435
value: Error,
@@ -247,7 +248,7 @@ D3TimeChart = function (elem, options) {
247248
// defines margin dimensions used in rendering of chart.
248249
this.margin = {
249250
top: 5,
250-
right: 60,
251+
right: 30,
251252
bottom: 50,
252253
left: 60,
253254
};
@@ -292,7 +293,7 @@ D3TimeChart = function (elem, options) {
292293
sampleNumberToIndexMap: null,
293294
unzoomedCompressionIndex: 0,
294295
},
295-
selection: null, // maybe would have been better to have named this "zoom": stores data related to zoom selection (e.g. data domain of magnified area, corresponding compression index to use for plotting this magnified data)
296+
selection: null, // maybe would have been better to have named this "zoom": stores data related to zoom selection (e.g. data domain of magnified area, corresponding compression index to use for plotting this magnified data). NOTE: set to null when zoomed all the way out.
296297
regions: null,
297298
brush: new BrushX(),
298299
height: null,
@@ -341,14 +342,14 @@ D3TimeChart = function (elem, options) {
341342
/** MISC MEMBERS */
342343
this.cancelSelectionSignalEmitted = false;
343344
this.shiftKeyHeld = false;
345+
this.ctrlKeyHeld = false;
344346
this.usingAddSelectionMode = false;
347+
this.usingRemoveSelectionMode = false;
345348
this.highlightModifier = null; // holds the key pressed in conjunction with a highlight gesture to modify the action
346349
this.draggedForward = false;
347350

348351
// held key modifiers
349352
this.keysHeld = {};
350-
this.backgroundSelectionKeyHeld = false;
351-
this.secondarySelectionKeyHeld = false;
352353

353354
/** GLOBAL LISTENERS */
354355
// listeners to support esc canceling of highlighting, held key modifiers, and arrow-key panning
@@ -628,8 +629,8 @@ D3TimeChart.prototype.reinitializeChart = function (options) {
628629

629630
/**
630631
* Handler for the initiation of a selection gesture.
631-
*/
632-
var startSelection = () => {
632+
*/
633+
var startSelection = (options) => {
633634
if (options && options.touch) {
634635
d3.event.preventDefault();
635636
d3.event.stopPropagation();
@@ -705,7 +706,7 @@ D3TimeChart.prototype.reinitializeChart = function (options) {
705706
/**
706707
* Handler for the progression of a selection gesture.
707708
*/
708-
var moveSelection = () => {
709+
var moveSelection = (options) => {
709710
if (options && options.touch) {
710711
d3.event.preventDefault();
711712
d3.event.stopPropagation();
@@ -746,7 +747,6 @@ D3TimeChart.prototype.reinitializeChart = function (options) {
746747
/**
747748
* Handler for the termination of a selection gesture.
748749
*/
749-
750750
var endSelection = (options) => {
751751
if (options && options.touch) {
752752
d3.event.preventDefault();
@@ -830,9 +830,9 @@ D3TimeChart.prototype.reinitializeChart = function (options) {
830830

831831
// touch drag behavior
832832
this.rect
833-
.on("touchstart", startSelection)
834-
.on("touchmove", moveSelection)
835-
.on("touchend", endSelection);
833+
.on("touchstart", () => startSelection({ touch: true }))
834+
.on("touchmove", () => moveSelection({ touch: true }))
835+
.on("touchend", () => endSelection({ touch: true }));
836836

837837
// mouse drag behavior
838838
var selectionDrag = d3.behavior
@@ -915,7 +915,7 @@ D3TimeChart.prototype.reinitializeChart = function (options) {
915915

916916
this.bottomAxisRect.call(panDrag);
917917

918-
// Special behavior for PAN mode.
918+
// Special behavior for PAN interaction mode.
919919
if (this.userInteractionMode === this.UserInteractionModeEnum.PAN) {
920920
this.rect
921921
.on("touchstart", () => startPanDragSelection({ touch: true }))
@@ -2082,6 +2082,12 @@ D3TimeChart.prototype.getDomainsFromRaw = function (rawData) {
20822082
};
20832083
};
20842084

2085+
/**
2086+
* Gets the minimum and maximum y-values corresponding to the given x-domain and compression index
2087+
* @param {*} xDomain : Array of x-domain: i.e. [leftEndPoint, rightEndPoint]
2088+
* @param {*} compressionIndex : index into the formatted data array
2089+
* @returns Object of y-domains for the gamma and neutron data
2090+
*/
20852091
D3TimeChart.prototype.getYDomainsInRange = function (
20862092
xDomain,
20872093
compressionIndex

0 commit comments

Comments
 (0)