Skip to content

Commit

Permalink
fix(store): remap view ids
Browse files Browse the repository at this point in the history
  • Loading branch information
forrest committed Jan 14, 2022
1 parent 9b16e8d commit 1bf2f84
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/samples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Images from 'paraview-glance/src/samples/images';

const version =
window.GLANCE_VERSION && window.GLANCE_VERSION !== 'master'
? `v${window.GLANCE_VERSION}`
? window.GLANCE_VERSION
: 'master';

// prettier-ignore
Expand Down
5 changes: 5 additions & 0 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,11 @@ function createStore(injected) {
const ind = (keys.indexOf(lastViewPoint) + 1) % keys.length;
dispatch('changeCameraViewPoint', keys[ind]);
},

rewriteProxyIds({ dispatch }, oldToNewMapping) {
dispatch('widgets/rewriteProxyIds', oldToNewMapping);
dispatch('views/rewriteProxyIds', oldToNewMapping);
},
},
});

Expand Down
8 changes: 8 additions & 0 deletions src/store/views.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
} from 'paraview-glance/src/components/core/VtkView/constants';
import { DEFAULT_BACKGROUND } from 'paraview-glance/src/components/core/VtkView/palette';

import { wrapMutationAsAction } from 'paraview-glance/src/utils';

const { CaptureOn } = WidgetManagerConstants;

export default ({ proxyManager }) => ({
Expand Down Expand Up @@ -80,6 +82,11 @@ export default ({ proxyManager }) => ({
Vue.set(state.viewOrder, index, viewType);
Vue.set(state.viewOrder, dstIndex, srcViewType);
},
rewriteProxyIds(state, idMapping) {
Object.entries(state.viewTypeToId).forEach(([type, id]) => {
state.viewTypeToId[type] = idMapping[id];
});
},
},
actions: {
initViews({ commit, state }) {
Expand Down Expand Up @@ -235,5 +242,6 @@ export default ({ proxyManager }) => ({
setMaxTextureLODSize({ commit }, size) {
commit('setMaxTextureLODSize', size);
},
rewriteProxyIds: wrapMutationAsAction('rewriteProxyIds'),
},
});
5 changes: 1 addition & 4 deletions src/store/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,7 @@ export default ({ proxyManager }) => ({
setCroppingState: wrapMutationAsAction('setCroppingState'),
setDistanceUnitSymbol: wrapMutationAsAction('setDistanceUnitSymbol'),
setDistanceUnitFactor: wrapMutationAsAction('setDistanceUnitFactor'),
rewriteProxyIds: {
root: true,
handler: wrapMutationAsAction('rewriteProxyIds'),
},
rewriteProxyIds: wrapMutationAsAction('rewriteProxyIds'),
pxmProxyCreated: {
root: true,
handler({ state }, { proxy, proxyId }) {
Expand Down

0 comments on commit 1bf2f84

Please sign in to comment.