feat: `PointLayer` support multi lines (#837)

This commit is contained in:
susiwen8 2021-11-13 10:53:42 +08:00 committed by GitHub
parent fb64f1d1c8
commit f918b4fc13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -419,7 +419,7 @@ export default class TextModel extends BaseModel {
// @ts-ignore
size,
textAnchor,
'center',
'left',
spacing,
textOffset,
iconfont,

View File

@ -174,7 +174,7 @@ function shapeLines(
}
x = 0;
y += lineHeight;
y -= lineHeight + 5;
});
const { horizontalAlign, verticalAlign } = getAnchorAlignment(textAnchor);
@ -192,7 +192,7 @@ function shapeLines(
const height = y - yOffset;
shaping.top += -verticalAlign * height;
shaping.bottom = shaping.top + height;
shaping.bottom = shaping.top - height;
shaping.left += -horizontalAlign * maxLineLength;
shaping.right = shaping.left + maxLineLength;
}
@ -249,7 +249,7 @@ function shapeIconFont(
}
x = 0;
y += lineHeight;
y -= lineHeight + 5;
});
const { horizontalAlign, verticalAlign } = getAnchorAlignment(textAnchor);
@ -267,7 +267,7 @@ function shapeIconFont(
const height = y - yOffset;
shaping.top += -verticalAlign * height;
shaping.bottom = shaping.top + height;
shaping.bottom = shaping.top - height;
shaping.left += -horizontalAlign * maxLineLength;
shaping.right = shaping.left + maxLineLength;
}

View File

@ -39,7 +39,7 @@ export default class TextLayerDemo extends React.Component {
y: 'w',
},
})
.shape('s', 'text')
.shape(['s', 'm'], (...args) => args.map(i => `${i}\n`).join(''))
// .shape('circle')
.size(18)
.filter('t', (t) => {