6161 width: keyTopWidth + 'px'
6262 }"
6363 ></div >
64- <div class =" keylabels" >
64+ <div class =" keylabels" :class = " {'has-args': hasArguments } " >
6565 <!-- <div class="keylabel" :class="['keylabel-'+index]" v-for="(label,index) in keyData.labels">-->
6666 <!-- <div class="keylabel-inner">-->
6767 <!-- {{label}}-->
6868 <!-- </div>-->
6969 <!-- </div>-->
70- <div v-if =" !hasArguments" class =" keylabel keylabel-center" v-html =" mainLabel" ></div >
71- <div v-else class =" keylabel" >
72- <div class =" arg-top" >{{ mainLabel }}</div >
73- <div class =" arg-bottom" :class =" { selected: argsSelected }" >
74- {{ argLabel }}
75- </div >
76- </div >
70+ <div class =" keylabel keylabel-center" v-html =" mainLabel" ></div >
71+
7772 </div >
7873 </div >
7974</template >
8075
8176<script lang="ts" setup>
8277import { computed , ref , watch } from ' vue'
83- import { selectedLayer , selectedKeys , keyboardStore } from ' ../store'
78+ import { selectedLayer , selectedKeys } from ' ../store'
8479import { matrixPositionToIndex , renderLabel } from ' ../helpers'
8580
86- const props = defineProps ([' keyData' , ' keyIndex' , ' mode' , ' keymap' , ' matrixWidth' ])
81+ const props = defineProps ([' keyData' , ' keyIndex' , ' mode' , ' keymap' , ' matrixWidth' , ' layouts ' ])
8782defineEmits ([' selected' ])
8883
8984const keyGap = 4
@@ -110,7 +105,7 @@ const visible = computed(() => {
110105 const variant: number [] = props .keyData .variant
111106 if (variant ) {
112107 if (variant .length !== 2 ) return false
113- return keyboardStore .layouts [variant [0 ]].selected === variant [1 ]
108+ if ( props . layouts [ variant [ 0 ]]) return props .layouts [variant [0 ]].selected === variant [1 ]
114109 }
115110 // show keys that don't have variant
116111 return true
@@ -143,9 +138,8 @@ const keyHeight2 = computed(() => {
143138 return keyHeight2U .value * baseKeyWidth .value + (keyHeight2U .value - 1 ) * keyGap
144139})
145140const hasArguments = computed (() => {
146- return false
147- // if (!action.value) return false
148- // return action.value.includes(')')
141+ if (! action .value ) return false
142+ return action .value .includes (' )' )
149143})
150144const keyTopWidth = computed (() => {
151145 return keyWidth .value - keyGap * 2 - 4 // + ((keyWidthU.value-1)*keyGap))
@@ -171,16 +165,16 @@ const mainLabel = computed(() => {
171165 return renderLabel (action .value )
172166})
173167
174- const argLabel = computed (() => {
175- if (hasArguments .value && action .value ) {
176- const argAction = action .value .split (' (' )[1 ].replace (' )' , ' ' )
177- if (argAction .startsWith (' KC.' )) {
178- return argAction .split (' .' )[1 ]
179- }
180- return argAction
181- }
182- return
183- })
168+ // const argLabel = computed(() => {
169+ // if (hasArguments.value && action.value) {
170+ // const argAction = action.value.split('(')[1].replace(')', '')
171+ // if (argAction.startsWith('KC.')) {
172+ // return argAction.split('.')[1]
173+ // }
174+ // return argAction
175+ // }
176+ // return
177+ // })
184178
185179const mainSelected = ref (false )
186180const argsSelected = ref (false )
@@ -247,7 +241,7 @@ const rotationOrigin = computed(() => {
247241 .selected & {
248242 border-color : white ;
249243 z-index : 4 ;
250- box-shadow : rgba (0 , 0 , 0 , 0.6 ) 2px 2px 8px 0 ;
244+ // box-shadow: rgba(0, 0, 0, 0.6) 2px 2px 8px 0;
251245 }
252246}
253247.keyborder-blocker {
@@ -257,7 +251,7 @@ const rotationOrigin = computed(() => {
257251 height : 52px ;
258252 cursor : pointer ;
259253 @apply rounded ;
260- z-index : 1 ;
254+ z-index : 5 ;
261255}
262256.keytop {
263257 position : absolute ;
@@ -269,9 +263,9 @@ const rotationOrigin = computed(() => {
269263 background : #444 ;
270264 cursor : pointer ;
271265 @apply rounded ;
272- z-index : 2 ;
266+ // z-index: 2;
267+ z-index : 6 ;
273268 .selected & {
274- z-index : 5 ;
275269 }
276270}
277271.keylabels {
@@ -281,16 +275,17 @@ const rotationOrigin = computed(() => {
281275 left : 6px ;
282276 top : 4px ;
283277 right : 6px ;
284- z-index : 3 ;
278+ // z-index: 3;
279+ z-index : 7 ;
285280 .selected & {
286- z-index : 6 ;
287281 }
288282}
289283.keylabel {
290284 font-size : 12px ;
291285 position : absolute ;
292286 width : 100% ;
293287 height : calc (48px - 5px );
288+ @apply gap- 1;
294289
295290 & -0 {
296291 left : 8px ;
@@ -304,6 +299,7 @@ const rotationOrigin = computed(() => {
304299 }
305300 & -center {
306301 @apply flex items-center justify-center text-center ;
302+ flex-wrap : wrap ;
307303 }
308304 .arg-top {
309305 @apply text-center ;
@@ -357,5 +353,16 @@ const rotationOrigin = computed(() => {
357353 i .mdi {
358354 font-size : 18px ;
359355 }
356+ .has-args & {
357+ i .mdi {
358+ font-size : 14px ;
359+ }
360+ }
361+ }
362+ .keylabel-small {
363+ font-size : 9px ;
364+ font-weight : bold ;
365+ font-style : italic ;
366+ width : 100% ;
360367}
361368 </style >
0 commit comments