fix: calc bug

This commit is contained in:
CPPAlien 2021-06-22 16:59:52 +08:00
parent eeb4f8a0fa
commit beb630d5a2

View File

@ -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];
});