File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313 :id =" item.id"
1414 :type =" item.viewType"
1515 v-bind =" item.props"
16+ @focus =" onFocusView(item.id!, item.viewType!)"
1617 />
1718 </div >
1819 </div >
@@ -28,6 +29,13 @@ import { useViewStore } from '../store/views';
2829
2930export default defineComponent ({
3031 name: ' LayoutGrid' ,
32+ methods: {
33+ onFocusView(id : string , type : string ) {
34+ if (type === ' 2D' ) {
35+ useViewStore ().setActiveViewID (id );
36+ }
37+ },
38+ },
3139 props: {
3240 layout: {
3341 type: Object as PropType <Layout >,
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import {
1212interface State {
1313 layout : Layout ;
1414 viewSpecs : Record < string , ViewSpec > ;
15+ activeViewID : string ;
1516}
1617
1718export const useViewStore = defineStore ( 'view' , {
@@ -21,13 +22,17 @@ export const useViewStore = defineStore('view', {
2122 items : [ ] ,
2223 } ,
2324 viewSpecs : structuredClone ( InitViewSpecs ) ,
25+ activeViewID : '' ,
2426 } ) ,
2527 getters : {
2628 viewIDs ( state ) {
2729 return Object . keys ( state . viewSpecs ) ;
2830 } ,
2931 } ,
3032 actions : {
33+ setActiveViewID ( id : string ) {
34+ this . activeViewID = id ;
35+ } ,
3136 addView ( id : string ) {
3237 if ( ! ( id in this . viewSpecs ) ) {
3338 this . viewSpecs [ id ] = structuredClone ( DefaultViewSpec ) ;
You can’t perform that action at this time.
0 commit comments