From beb630d5a25414e0c80c384008c4e8a3b56ca29e Mon Sep 17 00:00:00 2001 From: CPPAlien Date: Tue, 22 Jun 2021 16:59:52 +0800 Subject: [PATCH] fix: calc bug --- painter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/painter.js b/painter.js index 32cc760..7a11ff4 100644 --- a/painter.js +++ b/painter.js @@ -851,7 +851,7 @@ function setStringPrototype(screenK, scale) { const formula = /^calc\((.+)\)$/.exec(this); if (formula && formula[1]) { // 进行 calc 计算 - const afterOne = formula[1].replace(/([^\s]+)\.(left|right|bottom|top|width|height)/g, word => { + const afterOne = formula[1].replace(/([^\s\(\+\-\*\/]+)\.(left|right|bottom|top|width|height)/g, word => { const [id, attr] = word.split('.'); return penCache.viewRect[id][attr]; });