mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-01-31 23:29:27 +08:00
fix: 优化滚动组件的性能
This commit is contained in:
parent
e9b9e4b069
commit
8cd675a332
@ -92,22 +92,30 @@ async function calHeight(first: boolean = false) {
|
||||
if (!first) {
|
||||
await sleep(20);
|
||||
}
|
||||
|
||||
const canvas = ctx.canvas;
|
||||
const style2 = getComputedStyle(canvas);
|
||||
if (!props.type || props.type === 'vertical') {
|
||||
if (props.noScroll) {
|
||||
canvas.style.width = `0px`;
|
||||
} else {
|
||||
canvas.style.width = `${width}px`;
|
||||
canvas.width = width * scale;
|
||||
canvas.height = parseFloat(style2.height) * scale;
|
||||
if (props.noScroll) canvas.style.width = `0px`;
|
||||
|
||||
if (props.type === 'horizontal') {
|
||||
}
|
||||
} else {
|
||||
main.style.flexDirection = 'column';
|
||||
if (props.noScroll) {
|
||||
canvas.style.height = `0px`;
|
||||
} else {
|
||||
canvas.style.height = `${width}px`;
|
||||
canvas.style.width = '98%';
|
||||
canvas.style.margin = '0 1% 0 1%';
|
||||
canvas.width = parseFloat(style2.width) * scale;
|
||||
canvas.height = width * scale;
|
||||
if (props.noScroll) canvas.style.height = `0px`;
|
||||
}
|
||||
}
|
||||
|
||||
await new Promise<void>(res => {
|
||||
requestAnimationFrame(() => {
|
||||
total =
|
||||
|
Loading…
Reference in New Issue
Block a user