Skip to content

Commit

Permalink
fixed exception when the position is setted and no path is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaGuarracino committed Jun 5, 2020
1 parent 1cb26e3 commit 29e5add
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/ControlHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class ControlHeader extends React.Component {
</span>
<div className={"row"}>
Jump to path at nucleotide position:
<span class="myarrow">
<span className="myarrow">
<input
type="string"
list="path"
Expand All @@ -192,7 +192,7 @@ class ControlHeader extends React.Component {
placeholder={"position"}
onChange={(event) =>
this.props.store.updatePathNucPos(
this.props.store.getPath(),
this.props.store.pathNucPos.path,
event.target.value
)
}
Expand Down
24 changes: 14 additions & 10 deletions src/ViewportInputsStore.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {types} from "mobx-state-tree";
import {urlExists} from "./URL";
import {arraysEqual} from "./utilities";
import { types } from "mobx-state-tree";
import { urlExists } from "./URL";
import { arraysEqual, isInt } from "./utilities";

const Chunk = types.model({
file: types.string,
Expand Down Expand Up @@ -158,10 +158,10 @@ RootStore = types
self.useConnector = !self.useConnector;
}
function updateHeight(event) {
self.pixelsPerRow = Math.max(1, Number(event.target.value));
self.pixelsPerRow = Math.max(1, Number(event.target.value));
}
function updateWidth(event) {
self.pixelsPerColumn = Math.max(3, Number(event.target.value));
self.pixelsPerColumn = Math.max(3, Number(event.target.value));
}

function tryJSONpath(event) {
Expand Down Expand Up @@ -233,12 +233,16 @@ RootStore = types
self.beginEndBin = [newBeginBin, newEndBin];
}
function updatePathNucPos(path, nucPos) {
if (nucPos) {
nucPos = parseInt(nucPos);
} else {
nucPos = 0;
//console.log('updatePathNucPos: ' + path + ' --- ' + nucPos)

if (path !== undefined) {
if (nucPos) {
nucPos = Math.abs(parseInt(nucPos));
} else {
nucPos = 0;
}
self.pathNucPos = { path: path, nucPos: nucPos };
}
self.pathNucPos = { path: path, nucPos: nucPos };
}

function setLoading(val) {
Expand Down

1 comment on commit 29e5add

@AndreaGuarracino
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#86 fixed exception when the position is setted and no path is selected

Please sign in to comment.