4444 v-model =" props.annotation.value"
4545 :label =" props.annotation.axis + '='"
4646 ></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 >
47+ <Transition name =" anntextslide" >
48+ <s-text-field
49+ v-if =" showText"
50+ class =" annotation-textfield"
51+ :label =" t('annotation.text')"
52+ v-model.lazy =" props.annotation.text"
53+ ></s-text-field >
54+ </Transition >
5355 </div >
5456 </div >
5557</template >
@@ -67,7 +69,7 @@ const props = defineProps<{
6769import emitter from " @/mitt" ;
6870import { ref , watch } from " vue" ;
6971watch ([() => props .annotation .axis , () => props .annotation .text ], () =>
70- emitter .emit (" require-post -update" , " annotations axis change" )
72+ emitter .emit (" require-full -update" , " annotations axis change" )
7173);
7274
7375import SIconDelete from " @/ui/icons/delete.vue" ;
@@ -77,18 +79,21 @@ import SIconTextfield from "@/ui/icons/textfield.vue";
7779import { useProfile } from " @/states" ;
7880const profile = useProfile ();
7981function deleteAnnotation() {
80- emitter .emit (" require-post -update" , " annotations axis change" );
82+ emitter .emit (" require-full -update" , " annotations axis change" );
8183 profile .annotations .splice (props .index , 1 );
8284}
8385
8486const showText = ref (false );
87+
88+ watch (showText , (value ) => {
89+ if (! value ) props .annotation .text = " " ;
90+ });
8591 </script >
8692
8793<style >
8894.plot-data.annotation {
8995 display : flex ;
9096 flex-direction : column ;
91- gap : 5px ;
9297}
9398.annotation-value {
9499 font-size : 20px ;
@@ -99,9 +104,33 @@ const showText = ref(false);
99104.annotation-texts {
100105 display : flex ;
101106 gap : 10px ;
107+ padding-top : 8px ;
108+ overflow : hidden ;
102109}
103110.annotation-texts s-text-field {
104111 width : 0 ;
105112 flex-grow : 1 ;
106113}
107114 </style >
115+
116+ <style >
117+ .anntextslide-enter-from ,
118+ .anntextslide-leave-to {
119+ flex-grow : 0 !important ;
120+ margin-left : -10px ;
121+ }
122+
123+ .anntextslide-leave-active {
124+ transition :
125+ flex-grow var (--s-motion-duration-medium1 ) var (--s-motion-easing-emphasized ),
126+ margin-left var (--s-motion-duration-medium1 )
127+ var (--s-motion-easing-emphasized ) 0.2s ;
128+ }
129+
130+ .anntextslide-enter-active {
131+ transition :
132+ flex-grow var (--s-motion-duration-medium1 ) var (--s-motion-easing-emphasized ),
133+ margin-left var (--s-motion-duration-medium1 )
134+ var (--s-motion-easing-emphasized );
135+ }
136+ </style >
0 commit comments