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

Don't reset zoom when doing a task hot swap #4049

Merged
merged 3 commits into from
Apr 29, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.md).
### Fixed
- Fixed a missing redirect after registering for an existing organization (with autoVerify=true) via the onboarding flow. [#3984](https://github.com/scalableminds/webknossos/pull/3984)
- Fixed rendering artifacts which could occur under certain conditions. [#4015](https://github.com/scalableminds/webknossos/pull/4015)
- Fixed that the zoom step was reset after switching to a new task. [#4049](https://github.com/scalableminds/webknossos/pull/4049)

### Removed
-
Expand Down
8 changes: 5 additions & 3 deletions frontend/javascripts/oxalis/model_initialization.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ export async function initialize(
}

const defaultState = determineDefaultState(UrlManager.initialState, tracing);
applyState(defaultState);

// Don't override zoom when swapping the task
applyState(defaultState, !initialFetch);

return initializationInformation;
}
Expand Down Expand Up @@ -470,7 +472,7 @@ function determineDefaultState(
return { position, zoomStep, rotation, activeNode };
}

export function applyState(state: $Shape<UrlManagerState>) {
export function applyState(state: $Shape<UrlManagerState>, ignoreZoom: boolean = false) {
if (state.activeNode != null) {
// Set the active node (without animating to its position) before setting the
// position, since the position should take precedence.
Expand All @@ -479,7 +481,7 @@ export function applyState(state: $Shape<UrlManagerState>) {
if (state.position != null) {
Store.dispatch(setPositionAction(state.position));
}
if (state.zoomStep != null) {
if (!ignoreZoom && state.zoomStep != null) {
Store.dispatch(setZoomStepAction(state.zoomStep));
}
if (state.rotation != null) {
Expand Down