Fix:修复给Text文本设置的字号没有加单位导致在一些浏览器上不生效的问题

This commit is contained in:
街角小林
2024-10-16 17:39:25 +08:00
parent 0ec20b8fa0
commit 4aa5a8c48b
4 changed files with 5 additions and 6 deletions

View File

@@ -183,7 +183,7 @@ class Style {
})
.css({
'font-family': styles.fontFamily,
'font-size': styles.fontSize,
'font-size': styles.fontSize + 'px',
'font-weight': styles.fontWeight,
'font-style': styles.fontStyle,
'text-decoration': styles.textDecoration
@@ -338,7 +338,7 @@ class Style {
node2.fill({ color: color })
fillNode.fill({ color: fill })
if (this.ctx.mindMap.opt.isShowExpandNum) {
node.attr({ 'font-size': fontSize, 'font-color': fontColor })
node.attr({ 'font-size': fontSize + 'px', 'font-color': fontColor })
}
}

View File

@@ -28,7 +28,7 @@ function createTextAvatar(item) {
color: '#fff'
})
.css({
'font-size': fontSize
'font-size': fontSize + 'px'
})
.dx(-fontSize / 2)
.dy((avatarSize - fontSize) / 2)

View File

@@ -224,8 +224,7 @@ class RichText {
box-sizing: border-box;
box-shadow: 0 0 20px rgba(0,0,0,.5);
outline: none;
word-break:
break-all;
word-break: break-all;
padding: ${paddingY}px ${paddingX}px;
`
this.textEditNode.addEventListener('click', e => {

View File

@@ -166,7 +166,7 @@ function styleText(node) {
})
.css({
'font-family': associativeLineTextFontFamily,
'font-size': associativeLineTextFontSize
'font-size': associativeLineTextFontSize + 'px'
})
}