Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scroll faster through tree comments #3041

Merged
merged 8 commits into from
Aug 13, 2018
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.md).

- Added two new properties to mapping json files. The `colors: [<hsvHueValue1>, <hsvHueValue2>, ...]` property can be used to specify up to 256 custom colors for the first 256 equivalence classes of the mapping. The `hideUnmappedIds: <true|false>` property indicates whether segments that were not mapped should be rendered transparently or not. [#2965](https://github.com/scalableminds/webknossos/pull/2965)
- Added a button for refreshing the dataset in the backend cache. [#2975](https://github.com/scalableminds/webknossos/pull/2975)
- Comments of tracing trees can now be cycled through by keeping n and p pressed. [#3041](https://github.com/scalableminds/webknossos/pull/3041)
- All dates in webknossos will be shown in the browser's timezone. On hover, a tooltip will show the date in UTC. [#2916](https://github.com/scalableminds/webknossos/pull/2916) ![image](https://user-images.githubusercontent.com/2486553/42888385-74c82bc0-8aa8-11e8-9c3e-7cfc90ce93bc.png)
- When merging datasets within a tracing via the merge-modal, the user can choose whether the merge should be executed directly in the currently opened tracing. Alternatively, a new annotation can be created which is accessible via the dashboard (as it has been before).
- Added shortcuts for moving along the current tracing direction in orthogonal mode. Pressing 'e' (and 'r' for the reverse direction) will move along the "current direction", which is defined by the vector between the last two created nodes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ import * as React from "react";
import Maybe from "data.maybe";
import Utils from "libs/utils";
import update from "immutability-helper";
import Store from "oxalis/store";
import { connect } from "react-redux";
import { Input, Menu, Dropdown, Tooltip, Icon, Modal, Button, Row, Col } from "antd";
import ButtonComponent from "oxalis/view/components/button_component";
import InputComponent from "oxalis/view/components/input_component";
import { InputKeyboardNoLoop } from "libs/input";
import { InputKeyboard } from "libs/input";
import { listenToStoreProperty } from "oxalis/model/helpers/listener_helpers";
import { getActiveTree, getActiveNode } from "oxalis/model/accessors/skeletontracing_accessor";
import {
setActiveNodeAction,
Expand Down Expand Up @@ -115,6 +117,19 @@ class CommentTabView extends React.PureComponent<Props, CommentTabStateType> {
isMarkdownModalVisible: false,
};

componentDidMount() {
this.storePropertyUnsubscribers.push(
listenToStoreProperty(
state => state.userConfiguration.keyboardDelay,
keyboardDelay => {
if (this.keyboard != null) {
this.keyboard.delay = keyboardDelay;
}
},
),
);
}

componentDidUpdate(prevProps) {
if (
this.listRef != null &&
Expand All @@ -128,12 +143,18 @@ class CommentTabView extends React.PureComponent<Props, CommentTabStateType> {

componentWillUnmount() {
this.keyboard.destroy();
this.unsubscribeStoreListeners();
}

keyboard = new InputKeyboardNoLoop({
n: () => this.nextComment(),
p: () => this.previousComment(),
});
storePropertyUnsubscribers: Array<() => void> = [];

keyboard = new InputKeyboard(
{
n: () => this.nextComment(),
p: () => this.previousComment(),
},
{ delay: Store.getState().userConfiguration.keyboardDelay },
);

nextComment = (forward: boolean = true) => {
getActiveNode(this.props.skeletonTracing).map(activeNode => {
Expand Down Expand Up @@ -193,6 +214,11 @@ class CommentTabView extends React.PureComponent<Props, CommentTabStateType> {
}));
};

unsubscribeStoreListeners() {
this.storePropertyUnsubscribers.forEach(unsubscribe => unsubscribe());
this.storePropertyUnsubscribers = [];
}

getActiveComment(createIfNotExisting: boolean = false) {
return Utils.zipMaybe(
getActiveTree(this.props.skeletonTracing),
Expand Down