Skip to content

Commit

Permalink
ISSUE #4623 - clipEdit is not enabled when changing viewpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
The-Daniel committed Jan 16, 2024
1 parent 818b504 commit 85d566a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
21 changes: 9 additions & 12 deletions frontend/src/v4/modules/viewerGui/viewerGui.sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ import { goBack } from 'connected-react-router';
import { all, put, select, take, takeLatest } from 'redux-saga/effects';

import { TicketsCardActions } from '@/v5/store/tickets/card/ticketsCard.redux';
import { ROUTES } from '../../constants/routes';
import { INITIAL_HELICOPTER_SPEED, VIEWER_GIZMO_MODES, VIEWER_EVENTS } from '../../constants/viewer';
import { INITIAL_HELICOPTER_SPEED, VIEWER_GIZMO_MODES, VIEWER_EVENTS, VIEWER_CLIP_MODES } from '../../constants/viewer';
import * as API from '../../services/api';
import { MultiSelect } from '../../services/viewer/multiSelect';
import { Viewer } from '../../services/viewer/viewer';
Expand All @@ -44,7 +43,7 @@ import { SequencesActions } from '../sequences';
import { StarredActions } from '../starred';
import { dispatch } from '../store';
import { TreeActions } from '../tree';
import { selectInitialView, selectViewpointsDomain, selectViewpointsList, ViewpointsActions, ViewpointsTypes } from '../viewpoints';
import { selectInitialView, selectViewpointsDomain, ViewpointsActions, ViewpointsTypes } from '../viewpoints';
import { ViewerGuiActions, ViewerGuiTypes } from './viewerGui.redux';
import {
selectClippingMode,
Expand Down Expand Up @@ -291,14 +290,11 @@ function* setClippingMode({ mode }) {
try {
const currentClipMode = yield select(selectClippingMode);
if (currentClipMode !== mode) {
yield all([
put(ViewerGuiActions.setClipModeSuccess(mode)),
Viewer.setClipMode(mode),
put(ViewerGuiActions.setGizmoMode(VIEWER_GIZMO_MODES.TRANSLATE)),
])
}
if (!mode) {
yield put(ViewerGuiActions.setClipEdit(false));
yield put(ViewerGuiActions.setClipModeSuccess(mode));
if (!mode) {
yield Viewer.clipToolDelete();
yield put(ViewerGuiActions.setClipEdit(false));
}
}
} catch (error) {
yield put(DialogActions.showErrorDialog('set', 'clip mode', error));
Expand Down Expand Up @@ -328,8 +324,9 @@ function* setClipEdit({ isClipEdit }) {
try {
const currentClipEdit = yield select(selectIsClipEdit);
if (currentClipEdit !== isClipEdit) {
const clippingMode = yield select(selectClippingMode);
yield all([
isClipEdit ? Viewer.startClipEdit() : Viewer.stopClipEdit(),
isClipEdit ? Viewer.startClip(clippingMode === VIEWER_CLIP_MODES.SINGLE) : Viewer.stopClipEdit(),
put(ViewerGuiActions.setClipEditSuccess(isClipEdit)),
])
}
Expand Down
5 changes: 1 addition & 4 deletions frontend/src/v4/services/viewer/viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1241,10 +1241,7 @@ export class ViewerService {
}

public setClipMode(mode) {
if (mode) {
const isSingle = mode === 'SINGLE';
this.startClip(isSingle);
} else {
if (!mode) {
this.clipToolDelete()
}
this.emit(VIEWER_EVENTS.UPDATE_CLIP_MODE, mode);
Expand Down

0 comments on commit 85d566a

Please sign in to comment.