Skip to content

Commit 0efb42f

Browse files
committed
标线界面改动
替换文本图标,添加输入框动画
1 parent a479e2f commit 0efb42f

File tree

2 files changed

+39
-10
lines changed

2 files changed

+39
-10
lines changed

src/editor/annotation.vue

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,14 @@
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<{
6769
import emitter from "@/mitt";
6870
import { ref, watch } from "vue";
6971
watch([() => 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
7375
import SIconDelete from "@/ui/icons/delete.vue";
@@ -77,18 +79,21 @@ import SIconTextfield from "@/ui/icons/textfield.vue";
7779
import { useProfile } from "@/states";
7880
const profile = useProfile();
7981
function 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
8486
const 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>

src/ui/icons/textfield.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<s-icon>
33
<svg viewBox="0 -960 960 960">
44
<path
5-
d="M280-160v-520H80v-120h520v120H400v520H280Zm360 0v-320H520v-120h360v120H760v320H640Z"
5+
d="M80-120v-80h800v80H80Zm680-160v-560h60v560h-60Zm-600 0 210-560h100l210 560h-96l-50-144H308l-52 144h-96Zm176-224h168l-82-232h-4l-82 232Z"
66
></path>
77
</svg>
88
</s-icon>

0 commit comments

Comments
 (0)