From 639d6da9d9671f94572c28223b8f528df5c7dfb9 Mon Sep 17 00:00:00 2001 From: astrophie Date: Mon, 12 Feb 2024 10:57:46 -0500 Subject: [PATCH 1/4] fix: updated types for projection fit --- src/projection.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/projection.ts b/src/projection.ts index 1eca2fed43..2ba7d46dcd 100644 --- a/src/projection.ts +++ b/src/projection.ts @@ -1,4 +1,4 @@ -import {BaseProjection, SignalRef, Vector2} from 'vega'; +import {BaseProjection, Fit, SignalRef, Vector2} from 'vega'; import {ExprRef} from './expr'; import {MapExcludeValueRefAndReplaceSignalWith, ProjectionType} from './vega.schema'; @@ -20,6 +20,11 @@ export interface Projection * The projection’s translation offset as a two-element array `[tx, ty]`. */ translate?: Vector2 | ES; // TODO: figure what's VL default value + + /** + * GeoJSON data to which the projection should attempt to automatically fit the `translate` and `scale` parameters. If object-valued, this parameter should be a GeoJSON Feature or FeatureCollection. If array-valued, each array member may be a GeoJSON Feature, FeatureCollection, or a sub-array of GeoJSON Features. + */ + fit?: Fit | Fit[] | ES; // Re-declare to override docs } /** From ef0cd848bac340c10d0d23c773c257ee13d8a65a Mon Sep 17 00:00:00 2001 From: Dominik Moritz Date: Thu, 15 Feb 2024 20:37:11 +0900 Subject: [PATCH 2/4] Update schema --- build/vega-lite-schema.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/vega-lite-schema.json b/build/vega-lite-schema.json index 02c23e5b0f..b5df62e9be 100644 --- a/build/vega-lite-schema.json +++ b/build/vega-lite-schema.json @@ -19991,7 +19991,8 @@ { "$ref": "#/definitions/ExprRef" } - ] + ], + "description": "GeoJSON data to which the projection should attempt to automatically fit the `translate` and `scale` parameters. If object-valued, this parameter should be a GeoJSON Feature or FeatureCollection. If array-valued, each array member may be a GeoJSON Feature, FeatureCollection, or a sub-array of GeoJSON Features." }, "fraction": { "anyOf": [ From d6a9051a859fe13feb86b7ebd40d4cdce411c1e9 Mon Sep 17 00:00:00 2001 From: astrophie Date: Wed, 13 Mar 2024 19:58:38 -0400 Subject: [PATCH 3/4] Added projection fit type regression test --- examples/specs/test_projection_fit_types.json | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 examples/specs/test_projection_fit_types.json diff --git a/examples/specs/test_projection_fit_types.json b/examples/specs/test_projection_fit_types.json new file mode 100644 index 0000000000..3aa4757843 --- /dev/null +++ b/examples/specs/test_projection_fit_types.json @@ -0,0 +1,32 @@ +{ + "$schema": "https://vega.github.io/schema/vega-lite/v5.json", + + "data": { + "url": "https://cdn.jsdelivr.net/npm/vega-datasets@2.2/data/world-110m.json", + "format": {"type": "topojson", "feature": "land"} + }, + "projection": { + "fit": { + "features": [ + { + "geometry": { + "coordinates": [[[-3, 52], [4, 52], [4, 45], [-3, 45], [-3, 52]]], + "type": "Polygon" + }, + "properties": {}, + "type": "Feature" + }, + { + "geometry": { + "coordinates": [[[-3, 59], [4, 59], [4, 52], [-3, 52], [-3, 59]]], + "type": "Polygon" + }, + "properties": {}, + "type": "Feature" + } + ], + "type": "FeatureCollection" + } + }, + "mark": {"type": "geoshape", "clip": true} +} From 79b5045f129d0134f7b919ea551eb9cb162e6773 Mon Sep 17 00:00:00 2001 From: astrophie Date: Tue, 26 Mar 2024 21:48:20 -0400 Subject: [PATCH 4/4] update: fixed example type --- ...rojection_fit_types.json => test_projection_fit_types.vl.json} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename examples/specs/{test_projection_fit_types.json => test_projection_fit_types.vl.json} (100%) diff --git a/examples/specs/test_projection_fit_types.json b/examples/specs/test_projection_fit_types.vl.json similarity index 100% rename from examples/specs/test_projection_fit_types.json rename to examples/specs/test_projection_fit_types.vl.json