File tree 2 files changed +13
-0
lines changed
2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 13
13
:id =" item.id"
14
14
:type =" item.viewType"
15
15
v-bind =" item.props"
16
+ @focus =" onFocusView(item.id!, item.viewType!)"
16
17
/>
17
18
</div >
18
19
</div >
@@ -28,6 +29,13 @@ import { useViewStore } from '../store/views';
28
29
29
30
export default defineComponent ({
30
31
name: ' LayoutGrid' ,
32
+ methods: {
33
+ onFocusView(id : string , type : string ) {
34
+ if (type === ' 2D' ) {
35
+ useViewStore ().setActiveViewID (id );
36
+ }
37
+ },
38
+ },
31
39
props: {
32
40
layout: {
33
41
type: Object as PropType <Layout >,
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import {
12
12
interface State {
13
13
layout : Layout ;
14
14
viewSpecs : Record < string , ViewSpec > ;
15
+ activeViewID : string ;
15
16
}
16
17
17
18
export const useViewStore = defineStore ( 'view' , {
@@ -21,13 +22,17 @@ export const useViewStore = defineStore('view', {
21
22
items : [ ] ,
22
23
} ,
23
24
viewSpecs : structuredClone ( InitViewSpecs ) ,
25
+ activeViewID : '' ,
24
26
} ) ,
25
27
getters : {
26
28
viewIDs ( state ) {
27
29
return Object . keys ( state . viewSpecs ) ;
28
30
} ,
29
31
} ,
30
32
actions : {
33
+ setActiveViewID ( id : string ) {
34
+ this . activeViewID = id ;
35
+ } ,
31
36
addView ( id : string ) {
32
37
if ( ! ( id in this . viewSpecs ) ) {
33
38
this . viewSpecs [ id ] = structuredClone ( DefaultViewSpec ) ;
You can’t perform that action at this time.
0 commit comments