feat(viewer): new selection implementation ✅
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
>
|
||||
<perfect-scrollbar style="height: 100vh" :options="{ suppressScrollX: true }">
|
||||
<div class="d-flex align-center" style="pointer-events: auto">
|
||||
<span class="caption">Selection Info</span>
|
||||
<span class="caption">Selection Info {{ isolated }}</span>
|
||||
<v-spacer />
|
||||
<v-btn
|
||||
v-show="objects.length > 1"
|
||||
@@ -66,18 +66,15 @@ import { useQuery } from '@vue/apollo-composable'
|
||||
import { computed } from 'vue'
|
||||
import gql from 'graphql-tag'
|
||||
import {
|
||||
isolateObjects,
|
||||
unisolateObjects
|
||||
clearSelectionDisplay,
|
||||
isolateObjects2,
|
||||
unIsolateObjects2
|
||||
} from '@/main/lib/viewer/commit-object-viewer/stateManager'
|
||||
export default {
|
||||
components: {
|
||||
ObjectPropertiesRow: () => import('@/main/components/viewer/ObjectPropertiesRow')
|
||||
},
|
||||
props: {
|
||||
// objects: {
|
||||
// type: Array,
|
||||
// default: () => []
|
||||
// },
|
||||
streamId: {
|
||||
type: String,
|
||||
default: null
|
||||
@@ -89,6 +86,7 @@ export default {
|
||||
commitObjectViewerState @client {
|
||||
isolateValues
|
||||
selectedObjects
|
||||
currentFilterState
|
||||
}
|
||||
}
|
||||
`)
|
||||
@@ -123,27 +121,29 @@ export default {
|
||||
},
|
||||
isolated() {
|
||||
// TODO
|
||||
return false
|
||||
// const ids = this.objects.map((o) => o.id)
|
||||
// ids.forEach((val) => {
|
||||
// if (this.viewerState.isolateValues.indexOf(val) === -1) return false
|
||||
// })
|
||||
// return true
|
||||
// return false
|
||||
const ids = this.objects.map((o) => o.id)
|
||||
if (!this.viewerState.currentFilterState) return false
|
||||
if (!this.viewerState.currentFilterState.visibilityState) return false
|
||||
const stateName = this.viewerState.currentFilterState.visibilityState.name
|
||||
if (stateName !== 'isolateObjectsState') return false
|
||||
|
||||
ids.forEach((val) => {
|
||||
if (this.viewerState.currentFilterState.visibilityState.ids.indexOf(val) === -1)
|
||||
return false
|
||||
})
|
||||
return true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
isolateSelection() {
|
||||
// const ids = this.objects.map((o) => o.id)
|
||||
// if (!this.isolated)
|
||||
// unisolateObjects({
|
||||
// filterKey: '__parents',
|
||||
// filterValues: ids
|
||||
// })
|
||||
// else
|
||||
// isolateObjects({
|
||||
// filterKey: '__parents',
|
||||
// filterValues: ids
|
||||
// })
|
||||
const ids = this.objects.map((o) => o.id)
|
||||
if (!this.isolated) {
|
||||
clearSelectionDisplay()
|
||||
isolateObjects2(ids, 'ui-sel')
|
||||
} else {
|
||||
unIsolateObjects2(ids, 'ui-sel')
|
||||
}
|
||||
},
|
||||
getSelectionUrl() {
|
||||
if (this.objects.length < 2) return ''
|
||||
|
||||
@@ -222,8 +222,6 @@ export function handleViewerSelection(selectionInfo: SelectionEvent) {
|
||||
return
|
||||
}
|
||||
|
||||
console.log(selectionInfo.multiple)
|
||||
|
||||
const state = { ...commitObjectViewerState() }
|
||||
|
||||
if (selectionInfo.multiple) {
|
||||
@@ -232,13 +230,15 @@ export function handleViewerSelection(selectionInfo: SelectionEvent) {
|
||||
} else {
|
||||
state.selectedObjects = [selectionInfo.userData]
|
||||
}
|
||||
// TODO: FM.setSelection()
|
||||
|
||||
getInitializedViewer().FilteringManager.selectObjects(
|
||||
state.selectedObjects.map((o) => o.id) as string[]
|
||||
)
|
||||
console.log('state', state.selectedObjects)
|
||||
updateState(state)
|
||||
// updateState({ selectedObjects: state.selectedObjects })
|
||||
}
|
||||
|
||||
export function clearSelectionDisplay() {
|
||||
getInitializedViewer().FilteringManager.resetSelection()
|
||||
}
|
||||
|
||||
// FILTERING NEW
|
||||
@@ -257,6 +257,7 @@ export function isolateObjects2(
|
||||
)
|
||||
const state = { ...commitObjectViewerState() }
|
||||
state.currentFilterState = result
|
||||
console.log(result)
|
||||
updateState(state)
|
||||
}
|
||||
|
||||
|
||||
@@ -141,11 +141,9 @@
|
||||
pointer-events: none;`"
|
||||
>
|
||||
<object-selection
|
||||
v-show="!hideSelectionInfo"
|
||||
v-show="viewerState.selectedObjects.length !== 0 && !hideSelectionInfo"
|
||||
:key="'one'"
|
||||
:objects="selectionData"
|
||||
:stream-id="streamId"
|
||||
@clear-selection="selectionData = []"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -367,6 +365,7 @@ export default defineComponent({
|
||||
query {
|
||||
commitObjectViewerState @client {
|
||||
appliedFilter
|
||||
selectedObjects
|
||||
}
|
||||
}
|
||||
`)
|
||||
@@ -386,7 +385,6 @@ export default defineComponent({
|
||||
loadedModel: false,
|
||||
loadProgress: 0,
|
||||
showCommitEditDialog: false,
|
||||
selectionData: [] as Record<string, unknown>[],
|
||||
views: [] as Record<string, unknown>[],
|
||||
objectProperties: null as Nullable<Record<string, unknown>>,
|
||||
resources: [] as ResourceObjectType<AllSupportedDataTypes>[],
|
||||
|
||||
@@ -167,6 +167,7 @@ export class FilteringManager {
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
return this.setFilters()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user