字幕添加修改x坐标和宽度的功能

This commit is contained in:
fangxiang 2022-06-02 11:01:19 +08:00
parent c8b3591d35
commit 4851ee1504
4 changed files with 48 additions and 6 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -44,7 +44,7 @@
<q-input
:label="$t('background color')"
v-model="subtitle.background"
:disable="subtitle.bakcground_transparent"
:disable="subtitle.background_transparent"
:rules="['anyColor']"
hint=""
>
@ -63,14 +63,14 @@
<q-item-section>
<q-checkbox
:label="$t('background transparent')"
v-model="subtitle.bakcground_transparent"
v-model="subtitle.background_transparent"
/>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-select
:label="$t('speed')"
:label="$t('move speed')"
v-model="subtitle.x_speed"
:options="[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 15, 20]"
></q-select>
@ -86,6 +86,28 @@
/>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-input
type="number"
:label="$t('pos x')"
maxlength="4"
max="7680"
min="0"
v-model="subtitle.x"
/>
</q-item-section>
<q-item-section>
<q-input
type="number"
:label="$t('width')"
maxlength="4"
max="7680"
min="0"
v-model="subtitle.width"
/>
</q-item-section>
</q-item>
<q-item>
<q-item-section>
<q-checkbox
@ -220,7 +242,16 @@ export default defineComponent({
.getCurrentClient()
?.getSubtitle();
if (response) {
subtitle.value = response.subtitle;
try {
const temp = response.subtitle;
for (const item of Object.keys(subtitle.value)) {
if (typeof (<any>temp)[item] != "undefined") {
(<any>subtitle.value)[item] = (<any>temp)[item];
}
}
} catch {
subtitle.value = response.subtitle;
}
}
} catch (e) {
console.log(e);
@ -261,6 +292,13 @@ export default defineComponent({
async onSubmit() {
loading.value = true;
try {
subtitle.value.y_offset = parseInt(
subtitle.value.y_offset.toString()
);
subtitle.value.x_speed = parseInt(subtitle.value.x_speed.toString());
subtitle.value.x = parseInt(subtitle.value.x.toString());
subtitle.value.width = parseInt(subtitle.value.width.toString());
GlobalData.getInstance()
.getCurrentClient()
?.setSubtitle(subtitle.value);

View File

@ -2,7 +2,9 @@ export default class SubtitleEntity {
show: boolean = false;
x_speed: number = 0;
y_offset: number = 0;
x: number = 0;
width: number = 3840;
text: string = "";
background: string = "";
bakcground_transparent: boolean = false;
background_transparent: boolean = false;
}

View File

@ -165,7 +165,8 @@ export default {
"background color": "背景颜色",
"background transparent": "背景透明",
"move forward": "正向移动",
speed: "移动速度",
speed: "速度",
"move speed": "移动速度",
width: "宽度",
height: "高度",
"x pos": "X坐标",
@ -574,4 +575,5 @@ export default {
hour_2_: "时",
"the start time should not exceed the current time, and the target time should not be less than the current time":
"正计时的时候起始时间不要超过当前时间,倒计时的时候目标时间不要小于当前时间",
"pos x": "X坐标",
};