Skip to content
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
286 changes: 261 additions & 25 deletions common/config/rush/pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion common/config/rush/version-policies.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"definitionName":"lockStepVersion","policyName":"vrenderMain","version":"1.0.11","nextBump":"patch"}]
[{"definitionName":"lockStepVersion","policyName":"vrenderMain","version":"1.0.12","nextBump":"patch"}]
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@visactor/vchart": "1.3.0",
"@visactor/vutils": "1.0.6",
"@visactor/vgrammar": "~0.5.7",
"@visactor/vrender": "workspace:1.0.11",
"@visactor/vrender": "workspace:1.0.12",
"markdown-it": "^13.0.0",
"highlight.js": "^11.8.0",
"axios": "^1.4.0",
Expand Down
6 changes: 6 additions & 0 deletions packages/react-vrender-utils/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"name": "@visactor/react-vrender-utils",
"entries": [
{
"version": "1.0.12",
"tag": "@visactor/react-vrender-utils_v1.0.12",
"date": "Wed, 20 Aug 2025 07:07:52 GMT",
"comments": {}
},
{
"version": "1.0.11",
"tag": "@visactor/react-vrender-utils_v1.0.11",
Expand Down
7 changes: 6 additions & 1 deletion packages/react-vrender-utils/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Change Log - @visactor/react-vrender-utils

This log was last generated on Tue, 19 Aug 2025 06:31:41 GMT and should not be manually modified.
This log was last generated on Wed, 20 Aug 2025 07:07:52 GMT and should not be manually modified.

## 1.0.12
Wed, 20 Aug 2025 07:07:52 GMT

_Version update only_

## 1.0.11
Tue, 19 Aug 2025 06:31:41 GMT
Expand Down
6 changes: 3 additions & 3 deletions packages/react-vrender-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/react-vrender-utils",
"version": "1.0.11",
"version": "1.0.12",
"description": "",
"sideEffects": false,
"main": "cjs/index.js",
Expand All @@ -24,8 +24,8 @@
"react-dom": "^18.2.0"
},
"dependencies": {
"@visactor/vrender": "workspace:1.0.11",
"@visactor/react-vrender": "workspace:1.0.11",
"@visactor/vrender": "workspace:1.0.12",
"@visactor/react-vrender": "workspace:1.0.12",
"@visactor/vutils": "1.0.6",
"react-reconciler": "^0.29.0",
"tslib": "^2.3.1"
Expand Down
6 changes: 6 additions & 0 deletions packages/react-vrender/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"name": "@visactor/react-vrender",
"entries": [
{
"version": "1.0.12",
"tag": "@visactor/react-vrender_v1.0.12",
"date": "Wed, 20 Aug 2025 07:07:52 GMT",
"comments": {}
},
{
"version": "1.0.11",
"tag": "@visactor/react-vrender_v1.0.11",
Expand Down
7 changes: 6 additions & 1 deletion packages/react-vrender/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Change Log - @visactor/react-vrender

This log was last generated on Tue, 19 Aug 2025 06:31:41 GMT and should not be manually modified.
This log was last generated on Wed, 20 Aug 2025 07:07:52 GMT and should not be manually modified.

## 1.0.12
Wed, 20 Aug 2025 07:07:52 GMT

_Version update only_

## 1.0.11
Tue, 19 Aug 2025 06:31:41 GMT
Expand Down
4 changes: 2 additions & 2 deletions packages/react-vrender/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/react-vrender",
"version": "1.0.11",
"version": "1.0.12",
"description": "",
"sideEffects": false,
"main": "cjs/index.js",
Expand All @@ -23,7 +23,7 @@
"react": "^18.2.0"
},
"dependencies": {
"@visactor/vrender": "workspace:1.0.11",
"@visactor/vrender": "workspace:1.0.12",
"@visactor/vutils": "1.0.6",
"react-reconciler": "^0.29.0",
"tslib": "^2.3.1"
Expand Down
6 changes: 6 additions & 0 deletions packages/vrender-animate/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"name": "@visactor/vrender-animate",
"entries": [
{
"version": "1.0.12",
"tag": "@visactor/vrender-animate_v1.0.12",
"date": "Wed, 20 Aug 2025 07:07:52 GMT",
"comments": {}
},
{
"version": "1.0.11",
"tag": "@visactor/vrender-animate_v1.0.11",
Expand Down
7 changes: 6 additions & 1 deletion packages/vrender-animate/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Change Log - @visactor/vrender-animate

This log was last generated on Tue, 19 Aug 2025 06:31:41 GMT and should not be manually modified.
This log was last generated on Wed, 20 Aug 2025 07:07:52 GMT and should not be manually modified.

## 1.0.12
Wed, 20 Aug 2025 07:07:52 GMT

_Version update only_

## 1.0.11
Tue, 19 Aug 2025 06:31:41 GMT
Expand Down
4 changes: 2 additions & 2 deletions packages/vrender-animate/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/vrender-animate",
"version": "1.0.11",
"version": "1.0.12",
"description": "",
"sideEffects": false,
"main": "cjs/index.js",
Expand All @@ -21,7 +21,7 @@
},
"dependencies": {
"@visactor/vutils": "1.0.6",
"@visactor/vrender-core": "workspace:1.0.11"
"@visactor/vrender-core": "workspace:1.0.12"
},
"devDependencies": {
"@internal/bundler": "workspace:*",
Expand Down
6 changes: 6 additions & 0 deletions packages/vrender-components/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"name": "@visactor/vrender-components",
"entries": [
{
"version": "1.0.12",
"tag": "@visactor/vrender-components_v1.0.12",
"date": "Wed, 20 Aug 2025 07:07:52 GMT",
"comments": {}
},
{
"version": "1.0.11",
"tag": "@visactor/vrender-components_v1.0.11",
Expand Down
7 changes: 6 additions & 1 deletion packages/vrender-components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Change Log - @visactor/vrender-components

This log was last generated on Tue, 19 Aug 2025 06:31:41 GMT and should not be manually modified.
This log was last generated on Wed, 20 Aug 2025 07:07:52 GMT and should not be manually modified.

## 1.0.12
Wed, 20 Aug 2025 07:07:52 GMT

_Version update only_

## 1.0.11
Tue, 19 Aug 2025 06:31:41 GMT
Expand Down
8 changes: 4 additions & 4 deletions packages/vrender-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/vrender-components",
"version": "1.0.11",
"version": "1.0.12",
"description": "components library for dp visualization",
"sideEffects": false,
"main": "cjs/index.js",
Expand All @@ -27,9 +27,9 @@
"dependencies": {
"@visactor/vutils": "1.0.6",
"@visactor/vscale": "1.0.6",
"@visactor/vrender-core": "workspace:1.0.11",
"@visactor/vrender-kits": "workspace:1.0.11",
"@visactor/vrender-animate": "workspace:1.0.11"
"@visactor/vrender-core": "workspace:1.0.12",
"@visactor/vrender-kits": "workspace:1.0.12",
"@visactor/vrender-animate": "workspace:1.0.12"
},
"devDependencies": {
"@internal/bundler": "workspace:*",
Expand Down
62 changes: 47 additions & 15 deletions packages/vrender-components/src/label/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,14 +535,18 @@ export class LabelBase<T extends BaseLabelAttrs> extends AnimateComponent<T> {
this.isMarkInsideRect(this.getRelatedGraphic(label.attribute), bmpTool)
);

const { clampForce = true, hideOnHit = true, overlapPadding, strategy } = option;
if (clampForce) {
const { clampForce = true, hideOnHit = true, hideOnOverflow = false, overlapPadding, strategy } = option;
if (clampForce || hideOnOverflow) {
for (let i = 0; i < result.length; i++) {
const text = labels[i];
const { dx = 0, dy = 0 } = clampText(text as IText, bmpTool.width, bmpTool.height, bmpTool.padding);
if (dx !== 0 || dy !== 0) {
text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });
text._isClamped = true;
if (hideOnOverflow) {
text.setAttributes({ visible: false });
} else {
text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });
text._isClamped = true;
}
}
}
}
Expand All @@ -565,12 +569,16 @@ export class LabelBase<T extends BaseLabelAttrs> extends AnimateComponent<T> {
if (canPlace(bmpTool, bitmap, bounds, clampForce, overlapPadding)) {
bitmap.setRange(range);
} else {
if (clampForce) {
const placedAfterClampForce = this._processClampForce(text as IText, bmpTool, bitmap, overlapPadding);
if (placedAfterClampForce) {
if (hideOnOverflow) {
if (this._processHideOnOverflow(text as IText, bmpTool)) {
continue;
}
} else if (clampForce) {
if (this._processClampForce(text as IText, bmpTool, bitmap, overlapPadding)) {
continue;
}
}

if (hideOnHit) {
text.setAttributes({ visible: false });
} else {
Expand All @@ -581,6 +589,17 @@ export class LabelBase<T extends BaseLabelAttrs> extends AnimateComponent<T> {
return result;
}

protected _processHideOnOverflow(text: IText, bmpTool: BitmapTool) {
const { dy: dy = 0, dx: dx = 0 } = clampText(text, bmpTool.width, bmpTool.height, bmpTool.padding);
if (0 !== dx || 0 !== dy) {
text.setAttributes({
visible: false
});
return false;
}
return true;
}

protected _processClampForce(text: IText, bmpTool: BitmapTool, bitmap: Bitmap, overlapPadding = 0) {
const { dy = 0, dx = 0 } = clampText(text as IText, bmpTool.width, bmpTool.height, bmpTool.padding);
if (dx === 0 && dy === 0) {
Expand Down Expand Up @@ -621,7 +640,8 @@ export class LabelBase<T extends BaseLabelAttrs> extends AnimateComponent<T> {
hideOnHit = true,
clampForce = true,
avoidMarks = [],
overlapPadding
overlapPadding,
hideOnOverflow = false
} = option;
const result: (IText | IRichText)[] = [];

Expand Down Expand Up @@ -694,17 +714,29 @@ export class LabelBase<T extends BaseLabelAttrs> extends AnimateComponent<T> {
);
if (hasPlace !== false) {
text.setAttributes({ x: hasPlace.x, y: hasPlace.y });
result.push(text);
break;
// 需要判定是否超出边界
if (!(hideOnOverflow && !this._processHideOnOverflow(text as IText, bmpTool))) {
result.push(text);
break;
}
}
}

// 尝试向内挤压
if (!hasPlace && clampForce) {
const placedAfterClampForce = this._processClampForce(text as IText, bmpTool, bitmap, overlapPadding);
if (placedAfterClampForce) {
result.push(text);
continue;
if (!hasPlace) {
// 是否隐藏
if (hideOnOverflow) {
// 直接隐藏
if (!this._processHideOnOverflow(text as IText, bmpTool)) {
continue;
}
}
if (clampForce) {
// 向内挤压
if (this._processClampForce(text as IText, bmpTool, bitmap, overlapPadding)) {
result.push(text);
continue;
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions packages/vrender-components/src/label/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@ export interface OverlapAttrs {
*/
clampForce?: boolean;

/**
* 标签是否超出区域裁剪
* @default false
*/
hideOnOverflow?: boolean;

/**
* 是否躲避基础图元
* @default false
Expand Down
6 changes: 6 additions & 0 deletions packages/vrender-core/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"name": "@visactor/vrender-core",
"entries": [
{
"version": "1.0.12",
"tag": "@visactor/vrender-core_v1.0.12",
"date": "Wed, 20 Aug 2025 07:07:52 GMT",
"comments": {}
},
{
"version": "1.0.11",
"tag": "@visactor/vrender-core_v1.0.11",
Expand Down
7 changes: 6 additions & 1 deletion packages/vrender-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Change Log - @visactor/vrender-core

This log was last generated on Tue, 19 Aug 2025 06:31:41 GMT and should not be manually modified.
This log was last generated on Wed, 20 Aug 2025 07:07:52 GMT and should not be manually modified.

## 1.0.12
Wed, 20 Aug 2025 07:07:52 GMT

_Version update only_

## 1.0.11
Tue, 19 Aug 2025 06:31:41 GMT
Expand Down
2 changes: 1 addition & 1 deletion packages/vrender-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/vrender-core",
"version": "1.0.11",
"version": "1.0.12",
"description": "",
"sideEffects": [
"./src/modules.ts",
Expand Down
6 changes: 6 additions & 0 deletions packages/vrender-kits/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"name": "@visactor/vrender-kits",
"entries": [
{
"version": "1.0.12",
"tag": "@visactor/vrender-kits_v1.0.12",
"date": "Wed, 20 Aug 2025 07:07:52 GMT",
"comments": {}
},
{
"version": "1.0.11",
"tag": "@visactor/vrender-kits_v1.0.11",
Expand Down
7 changes: 6 additions & 1 deletion packages/vrender-kits/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Change Log - @visactor/vrender-kits

This log was last generated on Tue, 19 Aug 2025 06:31:41 GMT and should not be manually modified.
This log was last generated on Wed, 20 Aug 2025 07:07:52 GMT and should not be manually modified.

## 1.0.12
Wed, 20 Aug 2025 07:07:52 GMT

_Version update only_

## 1.0.11
Tue, 19 Aug 2025 06:31:41 GMT
Expand Down
4 changes: 2 additions & 2 deletions packages/vrender-kits/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/vrender-kits",
"version": "1.0.11",
"version": "1.0.12",
"description": "",
"sideEffects": false,
"main": "cjs/index.js",
Expand All @@ -21,7 +21,7 @@
},
"dependencies": {
"@visactor/vutils": "1.0.6",
"@visactor/vrender-core": "workspace:1.0.11",
"@visactor/vrender-core": "workspace:1.0.12",
"@resvg/resvg-js": "2.4.1",
"roughjs": "4.5.2",
"gifuct-js": "2.1.2",
Expand Down
Loading
Loading