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

Paint tool on startup fixes #507

Merged
merged 2 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 3 additions & 1 deletion src/components/tools/paint/PaintWidget2D.vue
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,16 @@ export default defineComponent({

const viewInteractor = computed(() => viewProxy.value!.getInteractor());

// Turn on widget visibility if mouse starts within view
// Turn on widget visibility and update stencil
// if mouse starts within view
onVTKEvent(viewInteractor, 'onMouseMove', () => {
if (!checkIfPointerInView) {
return;
}
checkIfPointerInView = false;

widgetRef.value!.setVisibility(true);
paintStore.setSliceAxis(viewAxisIndex.value);
});

onVTKEvent(viewInteractor, 'onMouseEnter', () => {
Expand Down
4 changes: 4 additions & 0 deletions src/store/tools/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ export const useToolStore = defineStore('tool', {
) {
const { tools } = manifest;

usePaintToolStore().deserialize(manifest, segmentGroupIDMap);

Object.values(ToolStoreMap)
// paint store uses segmentGroupIDMap
.filter((useStore) => useStore !== usePaintToolStore)
.map((useStore) => useStore?.())
.filter((store): store is IToolStore => !!store)
.forEach((store) => {
Expand Down
3 changes: 2 additions & 1 deletion src/store/tools/paint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,14 @@ export const usePaintToolStore = defineStore('paint', () => {
) {
const { paint } = manifest.tools;
setBrushSize.call(this, paint.brushSize);
setActiveSegment.call(this, paint.activeSegment);
setLabelmapOpacity.call(this, paint.labelmapOpacity);
isActive.value = manifest.tools.current === Tools.Paint;

if (paint.activeSegmentGroupID !== null) {
activeSegmentGroupID.value =
segmentGroupIDMap[paint.activeSegmentGroupID];
setActiveLabelmap(activeSegmentGroupID.value);
setActiveSegment.call(this, paint.activeSegment);
}
}

Expand Down
Loading