Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/label component ignore text buf #35

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/vrender-components/src/label/line.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export class LineLabel extends LabelBase<LineLabelAttrs> {
fontSize: 12,
fill: '#000',
textAlign: 'center',
textBaseline: 'middle'
textBaseline: 'middle',
boundsPadding: [-1, 0, -1, 0] // to ignore the textBound buf
},
position: 'end',
offset: 6,
Expand Down
3 changes: 2 additions & 1 deletion packages/vrender-components/src/label/rect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export class RectLabel extends LabelBase<RectLabelAttrs> {
fontSize: 12,
fill: '#000',
textAlign: 'center',
textBaseline: 'middle'
textBaseline: 'middle',
boundsPadding: [-1, 0, -1, 0] // to ignore the textBound buf
},
position: 'top',
offset: 5,
Expand Down
3 changes: 2 additions & 1 deletion packages/vrender-components/src/label/symbol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export class SymbolLabel extends LabelBase<SymbolLabelAttrs> {
fontSize: 12,
fill: '#000',
textAlign: 'center',
textBaseline: 'middle'
textBaseline: 'middle',
boundsPadding: [-1, 0, -1, 0] // to ignore the textBound buf
},
position: 'top',
offset: 5,
Expand Down
14 changes: 0 additions & 14 deletions packages/vrender/src/graphic/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,27 +101,13 @@ export class Text extends Graphic<ITextGraphicAttribute> implements IText {
this
) as AABBBounds;

this.clearUpdateBoundTag();
return bounds;
}
private updateAABBBounds(): AABBBounds {
const textTheme = getTheme(this).text;
const attribute = this.attribute;
const bounds = application.graphicService.updateTextAABBBounds(
attribute,
getTheme(this).text,
this._AABBBounds,
this
) as AABBBounds;

const { boundsPadding = textTheme.boundsPadding } = this.attribute;
const paddingArray = parsePadding(boundsPadding);
if (paddingArray) {
bounds.expand(paddingArray);
}

this.clearUpdateBoundTag();

return bounds;
}

Expand Down