Skip to main content

setProgressBar 设置进度条

setProgressBar

类型: MethodDeclaration

所属类: CommandFunctionList

定义位置: command.ts

描述

设置进度条

参数

参数名类型描述默认值
\{element, properties\}`{
element: ElementGetter
properties: Array<{key: string, value: any}>
}`--

返回值

类型: CommandFunction

源代码

位置: 第 4515 行

protected setProgressBar({element, properties}: {
element: ElementGetter
properties: Array<{key: string, value: any}>
}): CommandFunction {
const method = this.setProgressBar as any
if (!method.initialized) {
method.initialized = true
method.clipMap = {
'clip-0': true,
'clip-1': true,
'clip-2': true,
'clip-3': true,
}
method.colorMap = {
'color-0': true,
'color-1': true,
'color-2': true,
'color-3': true,
}
}
const getElement = Command.compileElement(element)
for (const property of properties) {
if (typeof property.value === 'object') {
property.value = Command.compileNumber(property.value)
}
}
return () => {
const element = getElement()
if (element instanceof ProgressBarElement) {
for (let {key, value} of properties) {
if (typeof value === 'function') {
value = value()
}
if (method.clipMap[key]) {
element.clip[parseInt(key[5])] = value
continue
}
if (method.colorMap[key]) {
element.color[parseInt(key[6])] = value
continue
}
// @ts-ignore
element[key] = value
}
}
return true
}
}

文档生成时间:2025/7/7 12:07:06