|
@@ -37,33 +37,37 @@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="oper-bar" :class="{ disabled: play }">
|
|
<div class="oper-bar" :class="{ disabled: play }">
|
|
- <Renderer v-model:scale="scale">
|
|
|
|
|
|
+ <Renderer v-model:scale="scale" ref="renderer">
|
|
<v-group>
|
|
<v-group>
|
|
- <template v-for="prop in tlProps">
|
|
|
|
- <TimeLine
|
|
|
|
- v-if="am[prop.attr].length"
|
|
|
|
- :items="am[prop.attr]"
|
|
|
|
- :height="prop.height"
|
|
|
|
- :background="prop.background"
|
|
|
|
- :opacity="prop.opacity"
|
|
|
|
- :top="prop.top"
|
|
|
|
- :itemsRenderer="prop.component"
|
|
|
|
- @update="({ ndx, time }) => (am[prop.attr][ndx].time = time)"
|
|
|
|
- @add="
|
|
|
|
- (item) => {
|
|
|
|
- am[prop.attr].push(item);
|
|
|
|
- $emit('update:active', {
|
|
|
|
- key: prop.attr,
|
|
|
|
- ndx: am[prop.attr].length - 1,
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- "
|
|
|
|
- @del="(ndx) => am[prop.attr].splice(ndx, 1)"
|
|
|
|
- :active="prop.attr === active?.key ? am[prop.attr][active.ndx] : undefined"
|
|
|
|
- @update:active="(active: any) => $emit('update:active', active && { key: prop.attr, ndx: am[prop.attr].indexOf(active) })"
|
|
|
|
- />
|
|
|
|
|
|
+ <template v-if="am">
|
|
|
|
+ <template v-for="prop in tlProps">
|
|
|
|
+ <TimeLine
|
|
|
|
+ v-if="am[prop.attr].length"
|
|
|
|
+ :items="am[prop.attr]"
|
|
|
|
+ :height="prop.height"
|
|
|
|
+ :background="prop.background"
|
|
|
|
+ :opacity="prop.opacity"
|
|
|
|
+ :top="prop.top"
|
|
|
|
+ :itemsRenderer="prop.component"
|
|
|
|
+ @update="({ ndx, time }) => (am![prop.attr][ndx].time = time)"
|
|
|
|
+ @add="
|
|
|
|
+ (item) => {
|
|
|
|
+ am![prop.attr].push(item);
|
|
|
|
+ $emit('update:active', {
|
|
|
|
+ key: prop.attr,
|
|
|
|
+ ndx: am![prop.attr].length - 1,
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ "
|
|
|
|
+ @del="(ndx) => am![prop.attr].splice(ndx, 1)"
|
|
|
|
+ :active="
|
|
|
|
+ prop.attr === active?.key ? am[prop.attr][active.ndx] : undefined
|
|
|
|
+ "
|
|
|
|
+ @update:active="(active: any) => $emit('update:active', active && { key: prop.attr, ndx: am![prop.attr].indexOf(active) })"
|
|
|
|
+ />
|
|
|
|
+ </template>
|
|
|
|
+ <empty v-if="!count" />
|
|
</template>
|
|
</template>
|
|
- <empty v-if="!count" />
|
|
|
|
</v-group>
|
|
</v-group>
|
|
<v-group>
|
|
<v-group>
|
|
<Time @update-current-time="(time) => $emit('update:currentTime', time)">
|
|
<Time @update-current-time="(time) => $emit('update:currentTime', time)">
|
|
@@ -81,7 +85,7 @@
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
import { Slider } from "ant-design-vue";
|
|
import { Slider } from "ant-design-vue";
|
|
-import { computed, ref, watch } from "vue";
|
|
|
|
|
|
+import { computed, ref, watch, watchEffect } from "vue";
|
|
import { AnimationModel } from "@/store/animation";
|
|
import { AnimationModel } from "@/store/animation";
|
|
import Renderer from "@/components/drawing/renderer.vue";
|
|
import Renderer from "@/components/drawing/renderer.vue";
|
|
import Time from "@/components/drawing-time/time.vue";
|
|
import Time from "@/components/drawing-time/time.vue";
|
|
@@ -93,7 +97,7 @@ import empty from "@/components/drawing-time-line/empty.vue";
|
|
import { Active } from "./type";
|
|
import { Active } from "./type";
|
|
|
|
|
|
const props = defineProps<{
|
|
const props = defineProps<{
|
|
- am: AnimationModel;
|
|
|
|
|
|
+ am?: AnimationModel;
|
|
active?: Active;
|
|
active?: Active;
|
|
currentTime: number;
|
|
currentTime: number;
|
|
follow: boolean;
|
|
follow: boolean;
|
|
@@ -142,7 +146,7 @@ const tlProps = [
|
|
] as const;
|
|
] as const;
|
|
|
|
|
|
const count = computed(() =>
|
|
const count = computed(() =>
|
|
- Object.values(tlProps).reduce((t, c) => t + props.am[c.attr].length, 0)
|
|
|
|
|
|
+ Object.values(tlProps).reduce((t, c) => (props.am ? t + props.am[c.attr].length : 0), 0)
|
|
);
|
|
);
|
|
|
|
|
|
const play = ref(false);
|
|
const play = ref(false);
|
|
@@ -161,6 +165,12 @@ watch(play, (_a, _b, onCleanup) => {
|
|
animation();
|
|
animation();
|
|
onCleanup(() => (isDes = true));
|
|
onCleanup(() => (isDes = true));
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+const renderer = ref<any>();
|
|
|
|
+watch(
|
|
|
|
+ () => props.am,
|
|
|
|
+ () => renderer.value.updateSize()
|
|
|
|
+);
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|