diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index afa1462b547..374684f58b6 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -22,6 +22,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released - Fixed a bug where some values in the project list were displayed incorrectly after pausing/unpausing the project. [#5339](https://github.com/scalableminds/webknossos/pull/5339) - Fixed that editing a task type would always re-add the default values to the recommended configuration (if enabled). [#5341](https://github.com/scalableminds/webknossos/pull/5341) - Fixed a bug where tasks created from existing volume annotations that did not have a specified bounding box were broken. [#5362](https://github.com/scalableminds/webknossos/pull/5361) +- Fixed a bug which could cause corrupted trees when CTRL+Rightclick was used in an empty tree. [#5385](https://github.com/scalableminds/webknossos/pull/5385) - Fixed a bug in Safari which could cause an error message (which is safe to ignore). [#5373](https://github.com/scalableminds/webknossos/pull/5373) - Fixed artifacts in screenshots near the dataset border. [#5324](https://github.com/scalableminds/webknossos/pull/5324) - Fixed a bug where the page would scroll up unexpectedly when showing various confirm modals. [#5371](https://github.com/scalableminds/webknossos/pull/5371) diff --git a/frontend/javascripts/oxalis/controller/combinations/skeletontracing_plane_controller.js b/frontend/javascripts/oxalis/controller/combinations/skeletontracing_plane_controller.js index 0e383fe173d..f972706e5a1 100644 --- a/frontend/javascripts/oxalis/controller/combinations/skeletontracing_plane_controller.js +++ b/frontend/javascripts/oxalis/controller/combinations/skeletontracing_plane_controller.js @@ -420,8 +420,10 @@ export function setWaypoint( const center = state.userConfiguration.centerNewNode && !ctrlIsPressed; // Only create a branchpoint if CTRL is pressed. Unless newNodeNewTree is activated (branchpoints make no sense then) const branchpoint = ctrlIsPressed && !state.userConfiguration.newNodeNewTree; - // Always activate the new node unless CTRL is pressed - const activate = !ctrlIsPressed; + // Always activate the new node unless CTRL is pressed. If there is no current node, + // the new one is still activated regardless of CTRL (otherwise, using CTRL+click in an empty tree multiple times would + // not create any edges; see https://github.com/scalableminds/webknossos/issues/5303). + const activate = !ctrlIsPressed || activeNodeMaybe.isNothing; addNode(position, rotation, createNewTree, center, branchpoint, activate); } diff --git a/frontend/javascripts/oxalis/model/reducers/skeletontracing_reducer_helpers.js b/frontend/javascripts/oxalis/model/reducers/skeletontracing_reducer_helpers.js index 93af39a5eae..01026486353 100644 --- a/frontend/javascripts/oxalis/model/reducers/skeletontracing_reducer_helpers.js +++ b/frontend/javascripts/oxalis/model/reducers/skeletontracing_reducer_helpers.js @@ -131,6 +131,11 @@ export function createNode( const { allowUpdate } = restrictions; const activeNodeMaybe = getActiveNodeFromTree(skeletonTracing, tree); + if (activeNodeMaybe.isNothing && tree.nodes.size() !== 0) { + console.error("Couldn't create a node in non-empty tree, because there is no active node."); + return Maybe.Nothing(); + } + if (allowUpdate) { // Use the same radius as current active node or revert to default value const radius = activeNodeMaybe