跳到主要内容

setWindow 设置窗口

setWindow

类型: MethodDeclaration

所属类: CommandFunctionList

定义位置: command.ts

描述

设置窗口

参数

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

返回值

类型: CommandFunction

源代码

位置: 第 4769 行

protected setWindow({element, properties}: {
element: ElementGetter
properties: Array<{key: string, value: any}>
}): CommandFunction {
const getElement = Command.compileElement(element)
for (const property of properties) {
switch (property.key) {
case 'scrollX':
case 'scrollY':
case 'gridWidth':
case 'gridHeight':
case 'gridGapX':
case 'gridGapY':
case 'paddingX':
case 'paddingY':
if (typeof property.value === 'object') {
property.value = Command.compileNumber(property.value, 0, 0, 10000)
}
continue
}
}
return () => {
const element = getElement()
if (element instanceof WindowElement) {
for (let {key, value} of properties) {
if (typeof value === 'function') {
value = value()
}
// @ts-ignore
element[key] = value
}
}
return true
}
}

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