barsa-novin-ray-core 2.3.3 → 2.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1600,7 +1600,8 @@ function throwIfAlreadyLoaded(parentModule, moduleName) {
|
|
|
1600
1600
|
}
|
|
1601
1601
|
const measureTextValues = {};
|
|
1602
1602
|
function measureText2(text, fontSize, fontName) {
|
|
1603
|
-
|
|
1603
|
+
const key = `${text}${fontSize}${fontName}`;
|
|
1604
|
+
if (measureTextValues[key]) {
|
|
1604
1605
|
return measureTextValues[text];
|
|
1605
1606
|
}
|
|
1606
1607
|
const measureTextDom = document.getElementById('measureText');
|
|
@@ -1612,7 +1613,7 @@ function measureText2(text, fontSize, fontName) {
|
|
|
1612
1613
|
fontName = fontName ? fontName : 'B-Font';
|
|
1613
1614
|
ctx.font = `normal ${fontSize} ${fontName}`;
|
|
1614
1615
|
const x = ctx.measureText(text).width;
|
|
1615
|
-
measureTextValues[
|
|
1616
|
+
measureTextValues[key] = x;
|
|
1616
1617
|
return x;
|
|
1617
1618
|
}
|
|
1618
1619
|
function measureText(text, fontSize) {
|