11<template >
2- <div class =" plot-data" >
3- <s-segmented-button v-model.lazy =" props.annotation.axis" >
4- <s-segmented-button-item value =" y" >{{
5- t("annotation.horizontal")
6- }}</s-segmented-button-item >
7- <s-segmented-button-item value =" x" >
8- {{ t("annotation.vertical") }}
9- </s-segmented-button-item >
10- </s-segmented-button >
11-
12- <s-tooltip >
13- <s-icon-button
14- slot =" trigger"
15- @click =" deleteAnnotation"
16- style =" color : var (--s-color-error )"
17- >
18- <SIconDelete />
19- </s-icon-button >
20- {{ t("buttons.del") }}
21- </s-tooltip >
22-
23- <s-text-field
24- class =" styled"
25- type =" number"
26- v-model =" props.annotation.value"
27- ></s-text-field >
28- <s-text-field
29- :label =" t('annotation.text')"
30- v-model.lazy =" props.annotation.text"
31- ></s-text-field >
2+ <div class =" plot-data annotation" >
3+ <div class =" selectors" >
4+ <s-segmented-button v-model.lazy =" props.annotation.axis" >
5+ <s-segmented-button-item value =" y" >{{
6+ t("annotation.horizontal")
7+ }}</s-segmented-button-item >
8+ <s-segmented-button-item value =" x" >
9+ {{ t("annotation.vertical") }}
10+ </s-segmented-button-item >
11+ </s-segmented-button >
12+ <div class =" grow" ></div >
13+ <div class =" dataBlockBtns" >
14+ <s-tooltip >
15+ <s-icon-button
16+ slot =" trigger"
17+ @click =" deleteAnnotation"
18+ style =" color : var (--s-color-error )"
19+ >
20+ <SIconDelete />
21+ </s-icon-button >
22+ {{ t("buttons.del") }}
23+ </s-tooltip >
24+ <s-tooltip >
25+ <s-icon-button
26+ slot =" trigger"
27+ :type =" showText ? 'filled-tonal' : 'standard'"
28+ @click =" showText = !showText"
29+ >
30+ <SIconTextfield />
31+ </s-icon-button >
32+ {{ t("annotation.text") }}
33+ </s-tooltip >
34+ <span class =" annotation-drag drag-icon" >
35+ <SIconDrag />
36+ </span >
37+ </div >
38+ </div >
39+
40+ <div class =" annotation-texts" :class =" { showText }" >
41+ <s-text-field
42+ class =" styled annotation-value"
43+ type =" number"
44+ v-model =" props.annotation.value"
45+ :label =" props.annotation.axis + '='"
46+ ></s-text-field >
47+ <s-text-field
48+ v-if =" showText"
49+ class =" annotation-textfield"
50+ :label =" t('annotation.text')"
51+ v-model.lazy =" props.annotation.text"
52+ ></s-text-field >
53+ </div >
3254 </div >
3355</template >
3456
@@ -43,15 +65,43 @@ const props = defineProps<{
4365}>();
4466
4567import emitter from " @/mitt" ;
46- import { watch } from " vue" ;
68+ import { ref , watch } from " vue" ;
4769watch ([() => props .annotation .axis , () => props .annotation .text ], () =>
48- emitter .emit (" require-post-update" , " anntaions axis change" )
70+ emitter .emit (" require-post-update" , " annotations axis change" )
4971);
5072
5173import SIconDelete from " @/ui/icons/delete.vue" ;
74+ import SIconDrag from " @/ui/icons/drag.vue" ;
75+ import SIconTextfield from " @/ui/icons/textfield.vue" ;
76+
5277import { useProfile } from " @/states" ;
5378const profile = useProfile ();
5479function deleteAnnotation() {
80+ emitter .emit (" require-post-update" , " annotations axis change" );
5581 profile .annotations .splice (props .index , 1 );
5682}
83+
84+ const showText = ref (false );
5785 </script >
86+
87+ <style >
88+ .plot-data.annotation {
89+ display : flex ;
90+ flex-direction : column ;
91+ gap : 5px ;
92+ }
93+ .annotation-value {
94+ font-size : 20px ;
95+ }
96+ .annotation-textfield {
97+ font-size : 16px ;
98+ }
99+ .annotation-texts {
100+ display : flex ;
101+ gap : 10px ;
102+ }
103+ .annotation-texts s-text-field {
104+ width : 0 ;
105+ flex-grow : 1 ;
106+ }
107+ </style >
0 commit comments