Skip to content

Commit

Permalink
Merge pull request #169 from VisActor/sync/main-to-0.18.0
Browse files Browse the repository at this point in the history
Sync/main to 0.18.0
  • Loading branch information
xile611 authored Feb 22, 2024
2 parents af560ec + 917f1cc commit 436dd92
Show file tree
Hide file tree
Showing 13 changed files with 63 additions and 12 deletions.
4 changes: 2 additions & 2 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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":"vutilMain","version":"0.17.4","nextBump":"patch"}]
[{"definitionName":"lockStepVersion","policyName":"vutilMain","version":"0.17.5","nextBump":"patch"}]
6 changes: 6 additions & 0 deletions packages/vdataset/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"name": "@visactor/vdataset",
"entries": [
{
"version": "0.17.5",
"tag": "@visactor/vdataset_v0.17.5",
"date": "Wed, 21 Feb 2024 07:17:30 GMT",
"comments": {}
},
{
"version": "0.17.4",
"tag": "@visactor/vdataset_v0.17.4",
Expand Down
7 changes: 6 additions & 1 deletion packages/vdataset/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Change Log - @visactor/vdataset

This log was last generated on Thu, 25 Jan 2024 06:33:00 GMT and should not be manually modified.
This log was last generated on Wed, 21 Feb 2024 07:17:30 GMT and should not be manually modified.

## 0.17.5
Wed, 21 Feb 2024 07:17:30 GMT

_Version update only_

## 0.17.4
Thu, 25 Jan 2024 06:33:00 GMT
Expand Down
4 changes: 2 additions & 2 deletions packages/vdataset/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/vdataset",
"version": "0.17.4",
"version": "0.17.5",
"main": "cjs/index.js",
"module": "es/index.js",
"types": "es/index.d.ts",
Expand Down Expand Up @@ -35,7 +35,7 @@
"test-cov": "jest -w 16 --coverage"
},
"dependencies": {
"@visactor/vutils": "workspace:0.17.4",
"@visactor/vutils": "workspace:0.17.5",
"@turf/flatten": "^6.5.0",
"@turf/helpers": "^6.5.0",
"@turf/rewind": "^6.5.0",
Expand Down
6 changes: 6 additions & 0 deletions packages/vscale/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"name": "@visactor/vscale",
"entries": [
{
"version": "0.17.5",
"tag": "@visactor/vscale_v0.17.5",
"date": "Wed, 21 Feb 2024 07:17:30 GMT",
"comments": {}
},
{
"version": "0.17.4",
"tag": "@visactor/vscale_v0.17.4",
Expand Down
7 changes: 6 additions & 1 deletion packages/vscale/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Change Log - @visactor/vscale

This log was last generated on Thu, 25 Jan 2024 06:33:00 GMT and should not be manually modified.
This log was last generated on Wed, 21 Feb 2024 07:17:30 GMT and should not be manually modified.

## 0.17.5
Wed, 21 Feb 2024 07:17:30 GMT

_Version update only_

## 0.17.4
Thu, 25 Jan 2024 06:33:00 GMT
Expand Down
15 changes: 15 additions & 0 deletions packages/vscale/__tests__/clamp.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { LinearScale } from '../src/linear-scale';

test('linear(x) will not ignores extra range values if the domain is smaller than the range', function () {
const scale = new LinearScale();

scale.clamp(true).domain([-10, 10]).range([100, 200]);
expect(scale.scale(0)).toBe(150);
expect(scale.scale(-50)).toBe(100);
expect(scale.scale(50)).toBe(200);

scale.domain([-100, 100]);
expect(scale.scale(0)).toBe(150);
expect(scale.scale(-50)).toBe(125);
expect(scale.scale(50)).toBe(175);
});
4 changes: 2 additions & 2 deletions packages/vscale/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/vscale",
"version": "0.17.4",
"version": "0.17.5",
"description": "Scales for visual encoding, used in VGrammar, VTable",
"keywords": [
"scale",
Expand Down Expand Up @@ -34,7 +34,7 @@
"test-cov": "jest -w 16 --coverage"
},
"dependencies": {
"@visactor/vutils": "workspace:0.17.4"
"@visactor/vutils": "workspace:0.17.5"
},
"devDependencies": {
"@internal/bundler": "workspace:*",
Expand Down
5 changes: 4 additions & 1 deletion packages/vscale/src/continuous-scale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export class ContinuousScale extends BaseScale implements IContinuousScale {
protected _domainValidator?: (val: number) => boolean;

_clamp?: (x: number) => number;
_autoClamp?: boolean;

constructor(transformer: TransformType = identity, untransformer: TransformType = identity) {
super();
Expand Down Expand Up @@ -154,7 +155,7 @@ export class ContinuousScale extends BaseScale implements IContinuousScale {
n = rangeLength;
}

if (this._clamp === undefined) {
if (this._autoClamp) {
this._clamp = clamper(domain[0], domain[n - 1]);
}
this._piecewise = n > 2 ? polymap : bimap;
Expand All @@ -172,8 +173,10 @@ export class ContinuousScale extends BaseScale implements IContinuousScale {
return this._clamp !== identity;
}
if (f) {
this._autoClamp = false;
this._clamp = f;
} else {
this._autoClamp = !!_;
this._clamp = _ ? undefined : identity;
}

Expand Down
6 changes: 6 additions & 0 deletions packages/vutils/CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"name": "@visactor/vutils",
"entries": [
{
"version": "0.17.5",
"tag": "@visactor/vutils_v0.17.5",
"date": "Wed, 21 Feb 2024 07:17:30 GMT",
"comments": {}
},
{
"version": "0.17.4",
"tag": "@visactor/vutils_v0.17.4",
Expand Down
7 changes: 6 additions & 1 deletion packages/vutils/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Change Log - @visactor/vutils

This log was last generated on Thu, 25 Jan 2024 06:33:00 GMT and should not be manually modified.
This log was last generated on Wed, 21 Feb 2024 07:17:30 GMT and should not be manually modified.

## 0.17.5
Wed, 21 Feb 2024 07:17:30 GMT

_Version update only_

## 0.17.4
Thu, 25 Jan 2024 06:33:00 GMT
Expand Down
2 changes: 1 addition & 1 deletion packages/vutils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@visactor/vutils",
"version": "0.17.4",
"version": "0.17.5",
"main": "cjs/index.js",
"module": "es/index.js",
"types": "es/index.d.ts",
Expand Down

0 comments on commit 436dd92

Please sign in to comment.