Skip to content

Commit

Permalink
Merge pull request #240 from VisActor/fix/marker-format
Browse files Browse the repository at this point in the history
Fix/marker format
  • Loading branch information
skie1997 authored Aug 3, 2023
2 parents 95ee374 + 791852e commit 18d0df5
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@visactor/vrender-components",
"comment": "chore: trigger publish alpha version",
"type": "patch"
}
],
"packageName": "@visactor/vrender-components"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@visactor/vrender-components",
"comment": "fix(marker): formatMethod logic should not in vrender",
"type": "patch"
}
],
"packageName": "@visactor/vrender-components"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@visactor/vrender-components",
"comment": "fix(marker): formatMethod logic should not in vrender",
"type": "patch"
}
],
"packageName": "@visactor/vrender-components"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@visactor/vrender-components",
"comment": "fix(marker): formatMethod logic should not in vrender",
"type": "patch"
}
],
"packageName": "@visactor/vrender-components"
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ export function run() {
position: guiObject.labelPos,
dx: guiObject.labelDx,
dy: guiObject.labelDy,
formatMethod: text => {
return text + '格式化';
},
areaStyle: {
cornerRadius: guiObject.cornerRadius
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ export function run() {
autoRotate: guiObject.labelAutoRotate,
refX: guiObject.labelRefX,
refY: guiObject.labelRefY,
refAngle: degreeToRadian(guiObject.labelRefAngle),
formatMethod: text => {
return text + '格式化';
}
refAngle: degreeToRadian(guiObject.labelRefAngle)
}
};
const markLine = new MarkLine({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ export function run() {
refY: guiObject.itemRefY,
refAngle: guiObject.itemRefAngle,
textStyle: {
text: 'mark point label text',
formatMethod: text => {
return text + '格式化';
}
text: 'mark point label text'
},
richTextStyle: {
textConfig: [
Expand Down
4 changes: 0 additions & 4 deletions packages/vrender-components/src/marker/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ export interface IMarkLabel extends Omit<TagAttributes, 'x' | 'y' | 'panel'> {
* 标签的背景面板配置
*/
panel?: IMarkBackgroundAttributes;
/**
* 标签自定义格式
*/
formatMethod?: (text: string | number | string[] | number[]) => string;
}

export interface IMarkRef {
Expand Down
5 changes: 2 additions & 3 deletions packages/vrender-components/src/tag/tag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ export class Tag extends AbstractComponent<Required<TagAttributes>> {
maxWidth,
padding = 4,
visible,
state,
formatMethod
state
} = this.attribute as TagAttributes;
const parsedPadding = normalizePadding(padding);

Expand Down Expand Up @@ -85,7 +84,7 @@ export class Tag extends AbstractComponent<Required<TagAttributes>> {
textX += symbolPlaceWidth;

const textAttrs = {
text: formatMethod ? formatMethod(text) : text,
text,
visible: isValid(text) && visible !== false,
lineHeight: textStyle?.fontSize,
...textStyle,
Expand Down
1 change: 0 additions & 1 deletion packages/vrender-components/src/tag/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export type TagAttributes = {
maxWidth?: number;
visible?: boolean;
state?: StateStyle;
formatMethod?: (text: string | number | string[] | number[]) => string;
} & Omit<IGroupGraphicAttribute, 'background'>;

export type TagShapeAttributes = {
Expand Down

0 comments on commit 18d0df5

Please sign in to comment.