mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-04-26 00:53:25 +08:00
feat: idea95 双击怪物手册拐点可以直接在拖动条上定位 单击版
This commit is contained in:
parent
5f324c0555
commit
6d8cd7cefc
@ -140,7 +140,11 @@ const nowDamage = computed(() => {
|
|||||||
return [originDamage - dam, dam];
|
return [originDamage - dam, dam];
|
||||||
});
|
});
|
||||||
|
|
||||||
function generateChart(ele: HTMLCanvasElement, data: [number, number][]) {
|
function generateChart(
|
||||||
|
ele: HTMLCanvasElement,
|
||||||
|
data: [number, number][],
|
||||||
|
ref?: Ref<number>
|
||||||
|
) {
|
||||||
Chart.defaults.color = '#aaa';
|
Chart.defaults.color = '#aaa';
|
||||||
const config: ChartConfiguration = {
|
const config: ChartConfiguration = {
|
||||||
type: 'line',
|
type: 'line',
|
||||||
@ -169,6 +173,15 @@ function generateChart(ele: HTMLCanvasElement, data: [number, number][]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
if (ref) {
|
||||||
|
config.options!.onClick = (e, elements) => {
|
||||||
|
if (elements.length > 0) {
|
||||||
|
const index = elements[0].index;
|
||||||
|
// @ts-ignore
|
||||||
|
ref.value = e.chart.data.labels[index];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
return new Chart(ele, config);
|
return new Chart(ele, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,8 +233,8 @@ onMounted(() => {
|
|||||||
setCanvasSize(c, width, height);
|
setCanvasSize(c, width, height);
|
||||||
setCanvasSize(d, width, height);
|
setCanvasSize(d, width, height);
|
||||||
|
|
||||||
const criChart = generateChart(c, allCri.value);
|
const criChart = generateChart(c, allCri.value, addAtk);
|
||||||
const defChart = generateChart(d, allDef.value);
|
const defChart = generateChart(d, allDef.value, addDef);
|
||||||
|
|
||||||
watch(addAtk, n => {
|
watch(addAtk, n => {
|
||||||
update(criChart, defChart);
|
update(criChart, defChart);
|
||||||
|
Loading…
Reference in New Issue
Block a user