-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #233 from eee555/dev
add BBBvSummary (#232)
- Loading branch information
Showing
16 changed files
with
370 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<template> | ||
<i class="pi pi-cog align-middle" style="justify-content: center; display: inline-flex; position: relative;" /> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import 'primeicons/primeicons.css' | ||
</script> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
front_end/src/components/visualization/BBBvSummary/App.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<template> | ||
<Header v-if="header" /> | ||
<el-row> | ||
<YLabel :minBv="minBv" :maxBv="maxBv" /> | ||
<span :style="{ position: 'relative', height: (maxBv - minBv + 1) / 10 * BBBvSummaryConfig.cellHeight + 'px', flex: '1' }"> | ||
<Cell v-for="bv in range(minBv, maxBv)" :bv="bv" :level="level" :videos="groupedVideoAbstract.get(bv)" | ||
:x-offset="getLastDigit(bv)" :y-offset="Math.floor((bv - minBv) / 10)" :color-theme="theme" /> | ||
</span> | ||
</el-row> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import BaseCardNormal from '@/components/common/BaseCardNormal.vue'; | ||
import { BBBvSummaryConfig, colorTheme, store } from '@/store'; | ||
import { ElRow } from 'element-plus'; | ||
import { maximum, minimum, range } from '@/utils/arrays'; | ||
import { getLastDigit, setLastDigit } from '@/utils/math'; | ||
import { MS_Level } from '@/utils/ms_const'; | ||
import { groupVideosByBBBv } from '@/utils/videoabstract'; | ||
import { computed, PropType } from 'vue'; | ||
import Header from './Header.vue'; | ||
import Cell from './Cell.vue'; | ||
import YLabel from './YLabel.vue'; | ||
import { PiecewiseColorScheme } from '@/utils/colors'; | ||
const prop = defineProps({ | ||
header: { type: Boolean, default: false }, | ||
level: { type: String as PropType<MS_Level>, required: true }, | ||
}) | ||
const groupedVideoAbstract = computed(() => groupVideosByBBBv(store.player.videos, prop.level)); | ||
const maxBv = computed(() => setLastDigit(maximum(groupedVideoAbstract.value.keys()), 9)); | ||
const minBv = computed(() => setLastDigit(minimum(groupedVideoAbstract.value.keys()), 0)); | ||
const theme = computed(() => { | ||
if (prop.level == 'b') return new PiecewiseColorScheme(colorTheme.value.btime.colors, colorTheme.value.btime.thresholds); | ||
else if (prop.level == 'i') return new PiecewiseColorScheme(colorTheme.value.itime.colors, colorTheme.value.itime.thresholds); | ||
else if (prop.level == 'e') return new PiecewiseColorScheme(colorTheme.value.etime.colors, colorTheme.value.etime.thresholds); | ||
else return new PiecewiseColorScheme([], []); | ||
}) | ||
</script> |
92 changes: 92 additions & 0 deletions
92
front_end/src/components/visualization/BBBvSummary/Cell.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<template> | ||
<tippy class="cell" :duration="0" sticky> | ||
<span v-if="bestIndex == -1"> </span> | ||
<el-link v-else :underline="false" @click="preview(videos[bestIndex].id)"> | ||
{{ videos[bestIndex].getStat(displayBy) }} | ||
</el-link> | ||
<template #content> | ||
test | ||
</template> | ||
</tippy> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { BBBvSummaryConfig, colorTheme } from '@/store'; | ||
import { VideoAbstract, getStat_stat } from '@/utils/videoabstract'; | ||
import { computed, PropType, ref, watch } from 'vue'; | ||
import { Tippy } from 'vue-tippy'; | ||
import { ElLink } from 'element-plus'; | ||
import { MS_Level } from '@/utils/ms_const'; | ||
import { PiecewiseColorScheme } from '@/utils/colors'; | ||
import tinycolor from 'tinycolor2'; | ||
import { preview } from '@/utils/common/PlayerDialog'; | ||
const bestValue = ref<number|null>(null); | ||
const bestIndex = ref(-1); | ||
const prop = defineProps({ | ||
level: { type: String as PropType<MS_Level>, required: true }, | ||
bv: { type: Number, required: true }, | ||
videos: { type: Array<VideoAbstract>, default: [] }, | ||
xOffset: { type: Number, default: 0 }, | ||
yOffset: { type: Number, default: 0 }, | ||
sortBy: { type: String as PropType<getStat_stat>, default: 'timems' }, | ||
sortDesc: { type: Boolean, default: false }, | ||
displayBy: { type: String as PropType<getStat_stat>, default: 'time' }, | ||
colorTheme: { type: Object as PropType<PiecewiseColorScheme>, default: new PiecewiseColorScheme([],[])} | ||
}) | ||
function refresh() { | ||
bestValue.value = null; | ||
bestIndex.value = -1; | ||
prop.videos.forEach((video, index) => { | ||
const thisValue = video.getStat(prop.sortBy); | ||
if ( | ||
bestValue.value === null || | ||
thisValue > bestValue.value && prop.sortDesc || | ||
thisValue < bestValue.value && !prop.sortDesc | ||
) { | ||
bestValue.value = thisValue; | ||
bestIndex.value = index; | ||
} | ||
}); | ||
} | ||
watch(() => prop.videos, refresh, { immediate: true }); | ||
const height = computed(() => BBBvSummaryConfig.value.cellHeight + 'px'); | ||
const borderRadius = computed(() => BBBvSummaryConfig.value.cornerRadius + '%'); | ||
const top = computed(() => prop.yOffset*BBBvSummaryConfig.value.cellHeight + 'px'); | ||
const left = computed(() => prop.xOffset * 10 + '%'); | ||
const color = computed(() => { | ||
if (bestIndex.value === -1) return 'rgba(0,0,0,0)'; | ||
return prop.colorTheme.getColor(prop.videos[bestIndex.value].getStat(prop.displayBy)) | ||
}) | ||
const fontColor = computed(() => tinycolor(color.value).isDark() ? 'white' : 'black'); | ||
</script> | ||
|
||
<style lang="less" scoped> | ||
.cell { | ||
position: absolute; | ||
top: v-bind(top); | ||
left: v-bind(left); | ||
width: 10%; | ||
height: v-bind(height); | ||
border-radius: 1px; | ||
background-color: v-bind(color); | ||
border-style: solid; | ||
border-width: 1px; | ||
text-align: center; | ||
align-items: center; | ||
} | ||
.el-link { | ||
--el-link-text-color: v-bind(fontColor); | ||
--el-link-font-size: 16px; | ||
} | ||
</style> |
19 changes: 19 additions & 0 deletions
19
front_end/src/components/visualization/BBBvSummary/Header.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<template> | ||
<el-row :style="{textAlign: 'center', height: BBBvSummaryConfig.cellHeight + 'px'}"> | ||
<IconSetting style="width: 10%; min-width: 75px"><Setting/></IconSetting> | ||
<span v-for="i in 10" style="flex: 1; min-width: 3em">{{ i-1 }}</span> | ||
</el-row> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { ElRow } from 'element-plus'; | ||
import IconSetting from '@/components/widgets/IconSetting.vue'; | ||
import Setting from './Setting.vue'; | ||
import { BBBvSummaryConfig } from '@/store'; | ||
const prop = defineProps({ | ||
}) | ||
</script> |
10 changes: 10 additions & 0 deletions
10
front_end/src/components/visualization/BBBvSummary/Setting.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<template> | ||
<el-text>行高</el-text> | ||
<el-input-number v-model="BBBvSummaryConfig.cellHeight" :min="10" :max="30" size="small" controls-position="right" /> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { BBBvSummaryConfig } from '@/store'; | ||
import { ElText, ElInputNumber } from 'element-plus'; | ||
</script> |
17 changes: 17 additions & 0 deletions
17
front_end/src/components/visualization/BBBvSummary/YLabel.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<template> | ||
<div style="width: 10%; min-width: 75px; text-align: center"> | ||
<div v-for="i of range(minBv, maxBv, 10)" :style="{width: '100%', height:BBBvSummaryConfig.cellHeight+'px'}">{{ i }}-{{ i+9 }}</div> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { BBBvSummaryConfig } from '@/store'; | ||
import { range } from '@/utils/arrays'; | ||
const prop = defineProps({ | ||
minBv: { type: Number, required: true }, | ||
maxBv: { type: Number, required: true }, | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.