Skip to content

Commit 22fc681

Browse files
committed
fix: preFillExpVars screenHeight/screenWidth (#1334)
1 parent fbc1652 commit 22fc681

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

app/src/main/kotlin/li/songe/gkd/data/RawSubscription.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -621,14 +621,16 @@ data class RawSubscription(
621621
return null
622622
}
623623

624-
private val expVars = arrayOf(
624+
private val preFillExpVars = arrayOf(
625625
"left",
626626
"top",
627627
"right",
628628
"bottom",
629629
"width",
630630
"height",
631-
"random"
631+
"random",
632+
"screenWidth",
633+
"screenHeight",
632634
)
633635

634636
private fun setVariables(exp: Expression?, rect: Rect) {
@@ -647,8 +649,8 @@ data class RawSubscription(
647649
private fun getExpression(value: String?): Expression? {
648650
return if (value != null) {
649651
try {
650-
ExpressionBuilder(value).variables(*expVars).build().apply {
651-
expVars.forEach { v ->
652+
ExpressionBuilder(value).variables(*preFillExpVars).build().apply {
653+
preFillExpVars.forEach { v ->
652654
// 预填充作 validate
653655
setVariable(v, 0.0)
654656
}

0 commit comments

Comments
 (0)