Skip to content

Commit

Permalink
Merge pull request #35 from VisActor/feat/label-component-ignore-text…
Browse files Browse the repository at this point in the history
…-buf

Feat/label component ignore text buf
  • Loading branch information
neuqzxy authored Jun 13, 2023
2 parents c465e69 + 4437198 commit d33c4d0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 17 deletions.
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

0 comments on commit d33c4d0

Please sign in to comment.