@mui/x-charts-premium 9.7.0 → 9.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChartPremium/BarChartPremium.d.mts +1 -1
- package/BarChartPremium/BarChartPremium.d.ts +1 -1
- package/BarChartPremium/BarChartPremium.js +14 -3
- package/BarChartPremium/BarChartPremium.mjs +14 -3
- package/BarChartPremium/RangeBar/AnimatedRangeBarElement.d.mts +2 -1
- package/BarChartPremium/RangeBar/AnimatedRangeBarElement.d.ts +2 -1
- package/BarChartPremium/RangeBar/FocusedRangeBar.d.mts +1 -1
- package/BarChartPremium/RangeBar/FocusedRangeBar.d.ts +1 -1
- package/BarChartPremium/RangeBar/seriesConfig/index.js +2 -2
- package/BarChartPremium/RangeBar/seriesConfig/index.mjs +2 -2
- package/BarChartPremium/RangeBar/seriesConfig/tooltipPosition.d.mts +2 -3
- package/BarChartPremium/RangeBar/seriesConfig/tooltipPosition.d.ts +2 -3
- package/BarChartPremium/RangeBar/seriesConfig/tooltipPosition.js +12 -15
- package/BarChartPremium/RangeBar/seriesConfig/tooltipPosition.mjs +11 -14
- package/BarChartPremium/webgl/BarWebGLProgram.d.mts +4 -5
- package/BarChartPremium/webgl/BarWebGLProgram.d.ts +4 -5
- package/BarChartPremium/webgl/BarWebGLProgram.js +24 -65
- package/BarChartPremium/webgl/BarWebGLProgram.mjs +24 -65
- package/BarChartPremium/webgl/shaders.d.mts +1 -1
- package/BarChartPremium/webgl/shaders.d.ts +1 -1
- package/BarChartPremium/webgl/shaders.js +2 -15
- package/BarChartPremium/webgl/shaders.mjs +3 -15
- package/CHANGELOG.md +249 -1
- package/CandlestickChart/CandlestickPlot.d.mts +2 -1
- package/CandlestickChart/CandlestickPlot.d.ts +2 -1
- package/CandlestickChart/seriesConfig/OHLCTooltipContent.d.mts +2 -1
- package/CandlestickChart/seriesConfig/OHLCTooltipContent.d.ts +2 -1
- package/CandlestickChart/seriesConfig/index.js +2 -2
- package/CandlestickChart/seriesConfig/index.mjs +2 -2
- package/CandlestickChart/seriesConfig/tooltipPosition.d.mts +2 -3
- package/CandlestickChart/seriesConfig/tooltipPosition.d.ts +2 -3
- package/CandlestickChart/seriesConfig/tooltipPosition.js +10 -14
- package/CandlestickChart/seriesConfig/tooltipPosition.mjs +10 -14
- package/ChartsDataProviderPremium/ChartsDataProviderPremium.d.mts +1 -1
- package/ChartsDataProviderPremium/ChartsDataProviderPremium.d.ts +1 -1
- package/ChartsDataProviderPremium/ChartsDataProviderPremium.js +2 -2
- package/ChartsDataProviderPremium/ChartsDataProviderPremium.mjs +2 -2
- package/ChartsGeoDataProviderPremium/ChartsGeoDataProviderPremium.d.mts +1 -1
- package/ChartsGeoDataProviderPremium/ChartsGeoDataProviderPremium.d.ts +1 -1
- package/ChartsGeoDataProviderPremium/ChartsGeoDataProviderPremium.js +2 -2
- package/ChartsGeoDataProviderPremium/ChartsGeoDataProviderPremium.mjs +2 -2
- package/ChartsGeoDataProviderPremium/ChartsGeoDataProviderPremium.plugins.d.mts +4 -3
- package/ChartsGeoDataProviderPremium/ChartsGeoDataProviderPremium.plugins.d.ts +4 -3
- package/ChartsGeoDataProviderPremium/ChartsGeoDataProviderPremium.plugins.js +2 -1
- package/ChartsGeoDataProviderPremium/ChartsGeoDataProviderPremium.plugins.mjs +2 -1
- package/ChartsGeoDataProviderPremium/index.d.mts +2 -1
- package/ChartsGeoDataProviderPremium/index.d.ts +2 -1
- package/ChartsRadialDataProviderPremium/ChartsRadialDataProviderPremium.d.mts +2 -1
- package/ChartsRadialDataProviderPremium/ChartsRadialDataProviderPremium.d.ts +2 -1
- package/ChartsRadialDataProviderPremium/ChartsRadialDataProviderPremium.js +2 -2
- package/ChartsRadialDataProviderPremium/ChartsRadialDataProviderPremium.mjs +2 -2
- package/ChartsRenderer/components/PaletteOption.d.mts +1 -1
- package/ChartsRenderer/components/PaletteOption.d.ts +1 -1
- package/ChartsZoomSlider/internals/previews/CandlestickPreviewPlot.d.mts +2 -1
- package/ChartsZoomSlider/internals/previews/CandlestickPreviewPlot.d.ts +2 -1
- package/ChartsZoomSlider/internals/previews/RangeBarPreviewPlot.d.mts +1 -1
- package/ChartsZoomSlider/internals/previews/RangeBarPreviewPlot.d.ts +1 -1
- package/HeatmapPremium/HeatmapPlotPremium.d.mts +1 -1
- package/HeatmapPremium/HeatmapPlotPremium.d.ts +1 -1
- package/HeatmapPremium/webgl/HeatmapWebGLProgram.js +12 -37
- package/HeatmapPremium/webgl/HeatmapWebGLProgram.mjs +12 -37
- package/HeatmapPremium/webgl/shaders.d.mts +3 -3
- package/HeatmapPremium/webgl/shaders.d.ts +3 -3
- package/HeatmapPremium/webgl/shaders.js +12 -15
- package/HeatmapPremium/webgl/shaders.mjs +13 -15
- package/HeatmapPremium/webgl/useHeatmapPlotData.js +3 -8
- package/HeatmapPremium/webgl/useHeatmapPlotData.mjs +3 -8
- package/Map/FocusedMapShape.d.mts +2 -1
- package/Map/FocusedMapShape.d.ts +2 -1
- package/Map/FocusedMapShape.js +5 -1
- package/Map/FocusedMapShape.mjs +5 -1
- package/Map/GeoDataPlot.d.mts +1 -1
- package/Map/GeoDataPlot.d.ts +1 -1
- package/Map/Graticule.d.mts +1 -1
- package/Map/Graticule.d.ts +1 -1
- package/Map/MapImagePlot.d.mts +39 -0
- package/Map/MapImagePlot.d.ts +39 -0
- package/Map/MapImagePlot.js +138 -0
- package/Map/MapImagePlot.mjs +132 -0
- package/Map/MapShape.d.mts +2 -2
- package/Map/MapShape.d.ts +2 -2
- package/Map/MapShape.js +6 -6
- package/Map/MapShape.mjs +6 -6
- package/Map/MapShapePlot.d.mts +9 -1
- package/Map/MapShapePlot.d.ts +9 -1
- package/Map/MapShapePlot.js +17 -5
- package/Map/MapShapePlot.mjs +17 -5
- package/Map/index.d.mts +2 -3
- package/Map/index.d.ts +2 -3
- package/Map/index.js +11 -0
- package/Map/index.mjs +1 -0
- package/Map/reprojectEquirectangularImage.d.mts +60 -0
- package/Map/reprojectEquirectangularImage.d.ts +60 -0
- package/Map/reprojectEquirectangularImage.js +116 -0
- package/Map/reprojectEquirectangularImage.mjs +110 -0
- package/Map/seriesConfig/descriptionGetter.js +5 -1
- package/Map/seriesConfig/descriptionGetter.mjs +5 -1
- package/Map/seriesConfig/getColor.js +18 -6
- package/Map/seriesConfig/getColor.mjs +18 -6
- package/Map/seriesConfig/highlight.d.mts +10 -0
- package/Map/seriesConfig/highlight.d.ts +10 -0
- package/Map/seriesConfig/highlight.js +52 -0
- package/Map/seriesConfig/highlight.mjs +45 -0
- package/Map/seriesConfig/identifierCleaner.d.mts +3 -0
- package/Map/seriesConfig/identifierCleaner.d.ts +3 -0
- package/Map/seriesConfig/identifierCleaner.js +14 -0
- package/Map/seriesConfig/identifierCleaner.mjs +8 -0
- package/Map/seriesConfig/identifierSerializer.d.mts +3 -0
- package/Map/seriesConfig/identifierSerializer.d.ts +3 -0
- package/Map/seriesConfig/identifierSerializer.js +12 -0
- package/Map/seriesConfig/identifierSerializer.mjs +6 -0
- package/Map/seriesConfig/index.js +8 -6
- package/Map/seriesConfig/index.mjs +7 -5
- package/Map/seriesConfig/keyboardFocusHandler.d.mts +0 -6
- package/Map/seriesConfig/keyboardFocusHandler.d.ts +0 -6
- package/Map/seriesConfig/keyboardFocusHandler.js +40 -7
- package/Map/seriesConfig/keyboardFocusHandler.mjs +41 -8
- package/Map/seriesConfig/seriesProcessor.js +11 -2
- package/Map/seriesConfig/seriesProcessor.mjs +11 -2
- package/Map/seriesConfig/tooltip.js +8 -4
- package/Map/seriesConfig/tooltip.mjs +8 -4
- package/Map/seriesConfig/tooltipPosition.d.mts +8 -3
- package/Map/seriesConfig/tooltipPosition.d.ts +8 -3
- package/Map/seriesConfig/tooltipPosition.js +15 -27
- package/Map/seriesConfig/tooltipPosition.mjs +16 -27
- package/RadialBarChart/RadialBarElement.d.mts +1 -1
- package/RadialBarChart/RadialBarElement.d.ts +1 -1
- package/RadialBarChart/seriesConfig/index.js +2 -2
- package/RadialBarChart/seriesConfig/index.mjs +2 -2
- package/RadialBarChart/seriesConfig/tooltipPosition.d.mts +2 -3
- package/RadialBarChart/seriesConfig/tooltipPosition.d.ts +2 -3
- package/RadialBarChart/seriesConfig/tooltipPosition.js +4 -6
- package/RadialBarChart/seriesConfig/tooltipPosition.mjs +2 -5
- package/RadialLineChart/RadialArea.d.mts +2 -1
- package/RadialLineChart/RadialArea.d.ts +2 -1
- package/RadialLineChart/RadialAreaPlot.d.mts +1 -1
- package/RadialLineChart/RadialAreaPlot.d.ts +1 -1
- package/RadialLineChart/RadialLine.d.mts +1 -1
- package/RadialLineChart/RadialLine.d.ts +1 -1
- package/RadialLineChart/RadialLineHighlightElement.d.mts +1 -1
- package/RadialLineChart/RadialLineHighlightElement.d.ts +1 -1
- package/RadialLineChart/RadialLineHighlightPlot.d.mts +1 -1
- package/RadialLineChart/RadialLineHighlightPlot.d.ts +1 -1
- package/RadialLineChart/RadialLinePlot.d.mts +1 -1
- package/RadialLineChart/RadialLinePlot.d.ts +1 -1
- package/RadialLineChart/RadialMarkPlot.d.mts +1 -1
- package/RadialLineChart/RadialMarkPlot.d.ts +1 -1
- package/RadialLineChart/seriesConfig/index.js +2 -2
- package/RadialLineChart/seriesConfig/index.mjs +2 -2
- package/RadialLineChart/seriesConfig/tooltipPosition.d.mts +2 -3
- package/RadialLineChart/seriesConfig/tooltipPosition.d.ts +2 -3
- package/RadialLineChart/seriesConfig/tooltipPosition.js +4 -6
- package/RadialLineChart/seriesConfig/tooltipPosition.mjs +2 -5
- package/ScatterChartPremium/ScatterPlotPremium.d.mts +2 -1
- package/ScatterChartPremium/ScatterPlotPremium.d.ts +2 -1
- package/ScatterChartPremium/webgl/ScatterWebGLPlot.d.mts +2 -1
- package/ScatterChartPremium/webgl/ScatterWebGLPlot.d.ts +2 -1
- package/ScatterChartPremium/webgl/ScatterWebGLProgram.d.mts +0 -2
- package/ScatterChartPremium/webgl/ScatterWebGLProgram.d.ts +0 -2
- package/ScatterChartPremium/webgl/ScatterWebGLProgram.js +23 -81
- package/ScatterChartPremium/webgl/ScatterWebGLProgram.mjs +23 -81
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/internals/createGetVisibleCoordinate.d.mts +14 -0
- package/internals/createGetVisibleCoordinate.d.ts +14 -0
- package/internals/createGetVisibleCoordinate.js +66 -0
- package/internals/createGetVisibleCoordinate.mjs +60 -0
- package/internals/plugins/useGeoProjection/factories.d.mts +3 -0
- package/internals/plugins/useGeoProjection/factories.d.ts +3 -0
- package/internals/plugins/useGeoProjection/factories.js +29 -0
- package/internals/plugins/useGeoProjection/factories.mjs +23 -0
- package/internals/plugins/useGeoProjection/projection.utils.d.mts +17 -0
- package/internals/plugins/useGeoProjection/projection.utils.d.ts +17 -0
- package/internals/plugins/useGeoProjection/projection.utils.js +67 -0
- package/internals/plugins/useGeoProjection/projection.utils.mjs +59 -0
- package/internals/plugins/useGeoProjection/useGeoProjection.js +7 -40
- package/internals/plugins/useGeoProjection/useGeoProjection.mjs +7 -40
- package/internals/plugins/useGeoProjection/useGeoProjection.selectors.d.mts +47 -11
- package/internals/plugins/useGeoProjection/useGeoProjection.selectors.d.ts +47 -11
- package/internals/plugins/useGeoProjection/useGeoProjection.selectors.js +118 -8
- package/internals/plugins/useGeoProjection/useGeoProjection.selectors.mjs +117 -8
- package/internals/plugins/useGeoProjection/useGeoProjection.types.d.mts +63 -2
- package/internals/plugins/useGeoProjection/useGeoProjection.types.d.ts +63 -2
- package/internals/plugins/useGeoProjectionZoom/gestureHooks/usePanOnDrag.d.mts +11 -0
- package/internals/plugins/useGeoProjectionZoom/gestureHooks/usePanOnDrag.d.ts +11 -0
- package/internals/plugins/useGeoProjectionZoom/gestureHooks/usePanOnDrag.js +65 -0
- package/internals/plugins/useGeoProjectionZoom/gestureHooks/usePanOnDrag.mjs +58 -0
- package/internals/plugins/useGeoProjectionZoom/gestureHooks/useZoomOnPinch.d.mts +13 -0
- package/internals/plugins/useGeoProjectionZoom/gestureHooks/useZoomOnPinch.d.ts +13 -0
- package/internals/plugins/useGeoProjectionZoom/gestureHooks/useZoomOnPinch.js +62 -0
- package/internals/plugins/useGeoProjectionZoom/gestureHooks/useZoomOnPinch.mjs +56 -0
- package/internals/plugins/useGeoProjectionZoom/gestureHooks/useZoomOnWheel.d.mts +13 -0
- package/internals/plugins/useGeoProjectionZoom/gestureHooks/useZoomOnWheel.d.ts +13 -0
- package/internals/plugins/useGeoProjectionZoom/gestureHooks/useZoomOnWheel.js +64 -0
- package/internals/plugins/useGeoProjectionZoom/gestureHooks/useZoomOnWheel.mjs +58 -0
- package/internals/plugins/useGeoProjectionZoom/index.d.mts +2 -0
- package/internals/plugins/useGeoProjectionZoom/index.d.ts +2 -0
- package/internals/plugins/useGeoProjectionZoom/index.js +12 -0
- package/internals/plugins/useGeoProjectionZoom/index.mjs +1 -0
- package/internals/plugins/useGeoProjectionZoom/mapZoom.utils.d.mts +31 -0
- package/internals/plugins/useGeoProjectionZoom/mapZoom.utils.d.ts +31 -0
- package/internals/plugins/useGeoProjectionZoom/mapZoom.utils.js +187 -0
- package/internals/plugins/useGeoProjectionZoom/mapZoom.utils.mjs +177 -0
- package/internals/plugins/useGeoProjectionZoom/rotationMath.d.mts +23 -0
- package/internals/plugins/useGeoProjectionZoom/rotationMath.d.ts +23 -0
- package/internals/plugins/useGeoProjectionZoom/rotationMath.js +190 -0
- package/internals/plugins/useGeoProjectionZoom/rotationMath.mjs +182 -0
- package/internals/plugins/useGeoProjectionZoom/useGeoProjectionZoom.d.mts +3 -0
- package/internals/plugins/useGeoProjectionZoom/useGeoProjectionZoom.d.ts +3 -0
- package/internals/plugins/useGeoProjectionZoom/useGeoProjectionZoom.js +174 -0
- package/internals/plugins/useGeoProjectionZoom/useGeoProjectionZoom.mjs +166 -0
- package/internals/plugins/useGeoProjectionZoom/useGeoProjectionZoom.types.d.mts +152 -0
- package/internals/plugins/useGeoProjectionZoom/useGeoProjectionZoom.types.d.ts +152 -0
- package/internals/plugins/useGeoProjectionZoom/useGeoProjectionZoom.types.js +5 -0
- package/internals/plugins/useGeoProjectionZoom/useGeoProjectionZoom.types.mjs +1 -0
- package/models/seriesType/mapShape.d.mts +2 -1
- package/models/seriesType/mapShape.d.ts +2 -1
- package/package.json +6 -6
- package/utils/webgl/glsl.d.mts +15 -0
- package/utils/webgl/glsl.d.ts +15 -0
- package/utils/webgl/glsl.js +34 -0
- package/utils/webgl/glsl.mjs +28 -0
- package/utils/webgl/instancedAttribute.d.mts +28 -0
- package/utils/webgl/instancedAttribute.d.ts +28 -0
- package/utils/webgl/instancedAttribute.js +57 -0
- package/utils/webgl/instancedAttribute.mjs +50 -0
- package/utils/webgl/utils.d.mts +21 -2
- package/utils/webgl/utils.d.ts +21 -2
- package/utils/webgl/utils.js +44 -8
- package/utils/webgl/utils.mjs +41 -7
|
@@ -20,7 +20,7 @@ export interface RadialLineHighlightPlotProps extends React.SVGAttributes<SVGGEl
|
|
|
20
20
|
*/
|
|
21
21
|
slotProps?: RadialLineHighlightPlotSlotProps;
|
|
22
22
|
}
|
|
23
|
-
declare function RadialLineHighlightPlot(props: RadialLineHighlightPlotProps):
|
|
23
|
+
declare function RadialLineHighlightPlot(props: RadialLineHighlightPlotProps): React.JSX.Element | null;
|
|
24
24
|
declare namespace RadialLineHighlightPlot {
|
|
25
25
|
var propTypes: any;
|
|
26
26
|
}
|
|
@@ -20,7 +20,7 @@ export interface RadialLineHighlightPlotProps extends React.SVGAttributes<SVGGEl
|
|
|
20
20
|
*/
|
|
21
21
|
slotProps?: RadialLineHighlightPlotSlotProps;
|
|
22
22
|
}
|
|
23
|
-
declare function RadialLineHighlightPlot(props: RadialLineHighlightPlotProps):
|
|
23
|
+
declare function RadialLineHighlightPlot(props: RadialLineHighlightPlotProps): React.JSX.Element | null;
|
|
24
24
|
declare namespace RadialLineHighlightPlot {
|
|
25
25
|
var propTypes: any;
|
|
26
26
|
}
|
|
@@ -2,7 +2,7 @@ import type { RadialLineClasses } from "./radialLineClasses.mjs";
|
|
|
2
2
|
export interface RadialLinePlotProps {
|
|
3
3
|
classes?: Partial<Pick<RadialLineClasses, 'line' | 'linePlot'>>;
|
|
4
4
|
}
|
|
5
|
-
declare function RadialLinePlot(props: RadialLinePlotProps): import("react
|
|
5
|
+
declare function RadialLinePlot(props: RadialLinePlotProps): import("react").JSX.Element;
|
|
6
6
|
declare namespace RadialLinePlot {
|
|
7
7
|
var propTypes: any;
|
|
8
8
|
}
|
|
@@ -2,7 +2,7 @@ import type { RadialLineClasses } from "./radialLineClasses.js";
|
|
|
2
2
|
export interface RadialLinePlotProps {
|
|
3
3
|
classes?: Partial<Pick<RadialLineClasses, 'line' | 'linePlot'>>;
|
|
4
4
|
}
|
|
5
|
-
declare function RadialLinePlot(props: RadialLinePlotProps): import("react
|
|
5
|
+
declare function RadialLinePlot(props: RadialLinePlotProps): import("react").JSX.Element;
|
|
6
6
|
declare namespace RadialLinePlot {
|
|
7
7
|
var propTypes: any;
|
|
8
8
|
}
|
|
@@ -2,7 +2,7 @@ import type { RadialLineClasses } from "./radialLineClasses.mjs";
|
|
|
2
2
|
export interface RadialMarkPlotProps {
|
|
3
3
|
classes?: Partial<Pick<RadialLineClasses, 'mark' | 'markPlot'>>;
|
|
4
4
|
}
|
|
5
|
-
declare function RadialMarkPlot(props: RadialMarkPlotProps): import("react
|
|
5
|
+
declare function RadialMarkPlot(props: RadialMarkPlotProps): import("react").JSX.Element;
|
|
6
6
|
declare namespace RadialMarkPlot {
|
|
7
7
|
var propTypes: any;
|
|
8
8
|
}
|
|
@@ -2,7 +2,7 @@ import type { RadialLineClasses } from "./radialLineClasses.js";
|
|
|
2
2
|
export interface RadialMarkPlotProps {
|
|
3
3
|
classes?: Partial<Pick<RadialLineClasses, 'mark' | 'markPlot'>>;
|
|
4
4
|
}
|
|
5
|
-
declare function RadialMarkPlot(props: RadialMarkPlotProps): import("react
|
|
5
|
+
declare function RadialMarkPlot(props: RadialMarkPlotProps): import("react").JSX.Element;
|
|
6
6
|
declare namespace RadialMarkPlot {
|
|
7
7
|
var propTypes: any;
|
|
8
8
|
}
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.radialLineSeriesConfig = void 0;
|
|
8
8
|
var _internals = require("@mui/x-charts/internals");
|
|
9
9
|
var _legend = _interopRequireDefault(require("./legend"));
|
|
10
|
-
var _tooltipPosition =
|
|
10
|
+
var _tooltipPosition = require("./tooltipPosition");
|
|
11
11
|
var _keyboardFocusHandler = _interopRequireDefault(require("./keyboardFocusHandler"));
|
|
12
12
|
var _axisTooltipGetter = require("./axisTooltipGetter");
|
|
13
13
|
var _getColor = _interopRequireDefault(require("./getColor"));
|
|
@@ -23,7 +23,7 @@ const radialLineSeriesConfig = exports.radialLineSeriesConfig = {
|
|
|
23
23
|
seriesProcessor: _seriesProcessor.default,
|
|
24
24
|
legendGetter: _legend.default,
|
|
25
25
|
tooltipGetter: _tooltip.default,
|
|
26
|
-
|
|
26
|
+
selectorTooltipItemPosition: _tooltipPosition.selectorTooltipItemPosition,
|
|
27
27
|
axisTooltipGetter: _axisTooltipGetter.axisTooltipGetter,
|
|
28
28
|
rotationExtremumGetter: _extremums.rotationExtremumGetter,
|
|
29
29
|
radiusExtremumGetter: _extremums.radiusExtremumGetter,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { identifierSerializerSeriesIdDataIndex, identifierCleanerSeriesIdDataIndex, createIsHighlighted, createIsFaded, polarSeriesTypes } from '@mui/x-charts/internals';
|
|
2
2
|
import legendGetter from "./legend.mjs";
|
|
3
|
-
import
|
|
3
|
+
import { selectorTooltipItemPosition } from "./tooltipPosition.mjs";
|
|
4
4
|
import keyboardFocusHandler from "./keyboardFocusHandler.mjs";
|
|
5
5
|
import { axisTooltipGetter } from "./axisTooltipGetter.mjs";
|
|
6
6
|
import colorProcessor from "./getColor.mjs";
|
|
@@ -16,7 +16,7 @@ export const radialLineSeriesConfig = {
|
|
|
16
16
|
seriesProcessor,
|
|
17
17
|
legendGetter,
|
|
18
18
|
tooltipGetter,
|
|
19
|
-
|
|
19
|
+
selectorTooltipItemPosition,
|
|
20
20
|
axisTooltipGetter,
|
|
21
21
|
rotationExtremumGetter,
|
|
22
22
|
radiusExtremumGetter,
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
declare const
|
|
3
|
-
export default tooltipItemPositionGetter;
|
|
1
|
+
import type { TooltipItemPositionSelector } from '@mui/x-charts/internals';
|
|
2
|
+
export declare const selectorTooltipItemPosition: TooltipItemPositionSelector<'radialLine'>;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
declare const
|
|
3
|
-
export default tooltipItemPositionGetter;
|
|
1
|
+
import type { TooltipItemPositionSelector } from '@mui/x-charts/internals';
|
|
2
|
+
export declare const selectorTooltipItemPosition: TooltipItemPositionSelector<'radialLine'>;
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
var _default = exports.default = tooltipItemPositionGetter;
|
|
6
|
+
exports.selectorTooltipItemPosition = void 0;
|
|
7
|
+
// Todo: to implement
|
|
8
|
+
const selectorTooltipItemPosition = () => null;
|
|
9
|
+
exports.selectorTooltipItemPosition = selectorTooltipItemPosition;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import type { RendererType, ScatterPlotProps, ScatterPlotSlots, ScatterPlotSlotProps } from '@mui/x-charts/ScatterChart';
|
|
2
3
|
export interface ScatterPlotPremiumSlots extends ScatterPlotSlots {}
|
|
3
4
|
export interface ScatterPlotPremiumSlotProps extends ScatterPlotSlotProps {}
|
|
@@ -23,7 +24,7 @@ export interface ScatterPlotPremiumProps extends Omit<ScatterPlotProps, 'rendere
|
|
|
23
24
|
declare function ScatterPlotPremium({
|
|
24
25
|
renderer,
|
|
25
26
|
...props
|
|
26
|
-
}: ScatterPlotPremiumProps):
|
|
27
|
+
}: ScatterPlotPremiumProps): React.JSX.Element;
|
|
27
28
|
declare namespace ScatterPlotPremium {
|
|
28
29
|
var propTypes: any;
|
|
29
30
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import type { RendererType, ScatterPlotProps, ScatterPlotSlots, ScatterPlotSlotProps } from '@mui/x-charts/ScatterChart';
|
|
2
3
|
export interface ScatterPlotPremiumSlots extends ScatterPlotSlots {}
|
|
3
4
|
export interface ScatterPlotPremiumSlotProps extends ScatterPlotSlotProps {}
|
|
@@ -23,7 +24,7 @@ export interface ScatterPlotPremiumProps extends Omit<ScatterPlotProps, 'rendere
|
|
|
23
24
|
declare function ScatterPlotPremium({
|
|
24
25
|
renderer,
|
|
25
26
|
...props
|
|
26
|
-
}: ScatterPlotPremiumProps):
|
|
27
|
+
}: ScatterPlotPremiumProps): React.JSX.Element;
|
|
27
28
|
declare namespace ScatterPlotPremium {
|
|
28
29
|
var propTypes: any;
|
|
29
30
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
/**
|
|
2
3
|
* @ignore - Internal component used for rendering the scatter plot using WebGL. Not exported from the package.
|
|
3
4
|
*/
|
|
4
|
-
export declare function ScatterWebGLPlot():
|
|
5
|
+
export declare function ScatterWebGLPlot(): React.JSX.Element | null;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
/**
|
|
2
3
|
* @ignore - Internal component used for rendering the scatter plot using WebGL. Not exported from the package.
|
|
3
4
|
*/
|
|
4
|
-
export declare function ScatterWebGLPlot():
|
|
5
|
+
export declare function ScatterWebGLPlot(): React.JSX.Element | null;
|
|
@@ -5,32 +5,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.ScatterWebGLProgram = void 0;
|
|
7
7
|
var _utils = require("../../utils/webgl/utils");
|
|
8
|
+
var _instancedAttribute = require("../../utils/webgl/instancedAttribute");
|
|
8
9
|
var _shaders = require("./shaders");
|
|
9
|
-
const QUAD_VERTICES = new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]);
|
|
10
10
|
class ScatterWebGLProgram {
|
|
11
11
|
shaders = [];
|
|
12
|
+
|
|
13
|
+
/* Colors come in as Uint8 [0, 255]; normalized=true makes the GPU read them back as vec4 in [0, 1]. */
|
|
14
|
+
|
|
12
15
|
constructor(gl) {
|
|
13
16
|
this.gl = gl;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
this.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const prog = initializeProgram(gl, _shaders.scatterVertexShader, _shaders.scatterFragmentShader);
|
|
20
|
-
this.program = prog.program;
|
|
21
|
-
this.shaders.push(prog.vertexShader, prog.fragmentShader);
|
|
17
|
+
(0, _utils.setupStandardBlending)(gl);
|
|
18
|
+
const linked = (0, _utils.linkProgram)(gl, _shaders.scatterVertexShader, _shaders.scatterFragmentShader);
|
|
19
|
+
this.program = linked.program;
|
|
20
|
+
this.shaders.push(...linked.shaders);
|
|
21
|
+
this.quadBuffer = (0, _utils.uploadQuadBuffer)(gl);
|
|
22
22
|
this.vao = gl.createVertexArray();
|
|
23
23
|
gl.bindVertexArray(this.vao);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
gl.enableVertexAttribArray(aPosition);
|
|
29
|
-
gl.vertexAttribPointer(aPosition, 2, gl.FLOAT, false, 0, 0);
|
|
30
|
-
this.centers = this.setupInstancedAttribute('a_center', 2, gl.FLOAT, false);
|
|
31
|
-
this.sizes = this.setupInstancedAttribute('a_size', 1, gl.FLOAT, false);
|
|
32
|
-
// Colors come in as Uint8 [0, 255]; normalized=true makes the GPU read them back as vec4 in [0, 1].
|
|
33
|
-
this.colors = this.setupInstancedAttribute('a_color', 4, gl.UNSIGNED_BYTE, true);
|
|
24
|
+
(0, _utils.bindQuadBuffer)(gl, this.program, this.quadBuffer);
|
|
25
|
+
this.centers = (0, _instancedAttribute.createInstancedAttribute)(gl, this.program, 'a_center', 2);
|
|
26
|
+
this.sizes = (0, _instancedAttribute.createInstancedAttribute)(gl, this.program, 'a_size', 1);
|
|
27
|
+
this.colors = (0, _instancedAttribute.createInstancedAttribute)(gl, this.program, 'a_color', 4, gl.UNSIGNED_BYTE, true);
|
|
34
28
|
gl.bindVertexArray(null);
|
|
35
29
|
}
|
|
36
30
|
setResolution(width, height) {
|
|
@@ -41,9 +35,12 @@ class ScatterWebGLProgram {
|
|
|
41
35
|
gl.uniform2f(gl.getUniformLocation(this.program, 'u_resolution'), width, height);
|
|
42
36
|
}
|
|
43
37
|
plot(plotData) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
this
|
|
38
|
+
const {
|
|
39
|
+
gl
|
|
40
|
+
} = this;
|
|
41
|
+
(0, _utils.uploadGrowableBuffer)(gl, this.centers.buffer, plotData.centers);
|
|
42
|
+
(0, _utils.uploadGrowableBuffer)(gl, this.sizes.buffer, plotData.sizes);
|
|
43
|
+
(0, _utils.uploadGrowableBuffer)(gl, this.colors.buffer, plotData.colors);
|
|
47
44
|
}
|
|
48
45
|
render(plotData) {
|
|
49
46
|
if (plotData.pointCount === 0) {
|
|
@@ -64,66 +61,11 @@ class ScatterWebGLProgram {
|
|
|
64
61
|
} = this;
|
|
65
62
|
gl.deleteProgram(this.program);
|
|
66
63
|
gl.deleteVertexArray(this.vao);
|
|
67
|
-
gl.deleteBuffer(this.centers.buffer);
|
|
68
|
-
gl.deleteBuffer(this.sizes.buffer);
|
|
69
|
-
gl.deleteBuffer(this.colors.buffer);
|
|
64
|
+
gl.deleteBuffer(this.centers.buffer.buffer);
|
|
65
|
+
gl.deleteBuffer(this.sizes.buffer.buffer);
|
|
66
|
+
gl.deleteBuffer(this.colors.buffer.buffer);
|
|
70
67
|
gl.deleteBuffer(this.quadBuffer);
|
|
71
68
|
this.shaders.forEach(shader => gl.deleteShader(shader));
|
|
72
69
|
}
|
|
73
|
-
|
|
74
|
-
// Assumes the owning VAO (Vertex Array Object) is already bound.
|
|
75
|
-
setupInstancedAttribute(name, size, glType, normalized) {
|
|
76
|
-
const {
|
|
77
|
-
gl,
|
|
78
|
-
program
|
|
79
|
-
} = this;
|
|
80
|
-
const buffer = gl.createBuffer();
|
|
81
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
82
|
-
const location = gl.getAttribLocation(program, name);
|
|
83
|
-
gl.enableVertexAttribArray(location);
|
|
84
|
-
gl.vertexAttribPointer(location, size, glType, normalized, 0, 0);
|
|
85
|
-
gl.vertexAttribDivisor(location, 1);
|
|
86
|
-
return {
|
|
87
|
-
buffer,
|
|
88
|
-
size,
|
|
89
|
-
glType,
|
|
90
|
-
capacityBytes: 0,
|
|
91
|
-
lastUploaded: null
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
uploadBuffer(target, data) {
|
|
95
|
-
if (target.lastUploaded === data) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
const {
|
|
99
|
-
gl
|
|
100
|
-
} = this;
|
|
101
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, target.buffer);
|
|
102
|
-
if (data.byteLength <= target.capacityBytes) {
|
|
103
|
-
gl.bufferSubData(gl.ARRAY_BUFFER, 0, data);
|
|
104
|
-
} else {
|
|
105
|
-
gl.bufferData(gl.ARRAY_BUFFER, data, gl.DYNAMIC_DRAW);
|
|
106
|
-
target.capacityBytes = data.byteLength;
|
|
107
|
-
}
|
|
108
|
-
target.lastUploaded = data;
|
|
109
|
-
}
|
|
110
70
|
}
|
|
111
|
-
exports.ScatterWebGLProgram = ScatterWebGLProgram;
|
|
112
|
-
function initializeProgram(gl, vertexShaderSource, fragmentShaderSource) {
|
|
113
|
-
const program = gl.createProgram();
|
|
114
|
-
const vertexShader = (0, _utils.compileShader)(gl, vertexShaderSource, gl.VERTEX_SHADER);
|
|
115
|
-
const fragmentShader = (0, _utils.compileShader)(gl, fragmentShaderSource, gl.FRAGMENT_SHADER);
|
|
116
|
-
gl.attachShader(program, vertexShader);
|
|
117
|
-
gl.attachShader(program, fragmentShader);
|
|
118
|
-
gl.linkProgram(program);
|
|
119
|
-
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
|
|
120
|
-
console.error(`Program linking failed: ${gl.getProgramInfoLog(program)}`);
|
|
121
|
-
console.error(`Vertex shader info-log: ${gl.getShaderInfoLog(vertexShader)}`);
|
|
122
|
-
console.error(`Fragment shader info-log: ${gl.getShaderInfoLog(fragmentShader)}`);
|
|
123
|
-
}
|
|
124
|
-
return {
|
|
125
|
-
program,
|
|
126
|
-
vertexShader,
|
|
127
|
-
fragmentShader
|
|
128
|
-
};
|
|
129
|
-
}
|
|
71
|
+
exports.ScatterWebGLProgram = ScatterWebGLProgram;
|
|
@@ -1,30 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { bindQuadBuffer, linkProgram, logWebGLErrors, setupStandardBlending, uploadGrowableBuffer, uploadQuadBuffer } from "../../utils/webgl/utils.mjs";
|
|
2
|
+
import { createInstancedAttribute } from "../../utils/webgl/instancedAttribute.mjs";
|
|
2
3
|
import { scatterVertexShader, scatterFragmentShader } from "./shaders.mjs";
|
|
3
|
-
const QUAD_VERTICES = new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]);
|
|
4
4
|
export class ScatterWebGLProgram {
|
|
5
5
|
shaders = [];
|
|
6
|
+
|
|
7
|
+
/* Colors come in as Uint8 [0, 255]; normalized=true makes the GPU read them back as vec4 in [0, 1]. */
|
|
8
|
+
|
|
6
9
|
constructor(gl) {
|
|
7
10
|
this.gl = gl;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
this.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const prog = initializeProgram(gl, scatterVertexShader, scatterFragmentShader);
|
|
14
|
-
this.program = prog.program;
|
|
15
|
-
this.shaders.push(prog.vertexShader, prog.fragmentShader);
|
|
11
|
+
setupStandardBlending(gl);
|
|
12
|
+
const linked = linkProgram(gl, scatterVertexShader, scatterFragmentShader);
|
|
13
|
+
this.program = linked.program;
|
|
14
|
+
this.shaders.push(...linked.shaders);
|
|
15
|
+
this.quadBuffer = uploadQuadBuffer(gl);
|
|
16
16
|
this.vao = gl.createVertexArray();
|
|
17
17
|
gl.bindVertexArray(this.vao);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
gl.enableVertexAttribArray(aPosition);
|
|
23
|
-
gl.vertexAttribPointer(aPosition, 2, gl.FLOAT, false, 0, 0);
|
|
24
|
-
this.centers = this.setupInstancedAttribute('a_center', 2, gl.FLOAT, false);
|
|
25
|
-
this.sizes = this.setupInstancedAttribute('a_size', 1, gl.FLOAT, false);
|
|
26
|
-
// Colors come in as Uint8 [0, 255]; normalized=true makes the GPU read them back as vec4 in [0, 1].
|
|
27
|
-
this.colors = this.setupInstancedAttribute('a_color', 4, gl.UNSIGNED_BYTE, true);
|
|
18
|
+
bindQuadBuffer(gl, this.program, this.quadBuffer);
|
|
19
|
+
this.centers = createInstancedAttribute(gl, this.program, 'a_center', 2);
|
|
20
|
+
this.sizes = createInstancedAttribute(gl, this.program, 'a_size', 1);
|
|
21
|
+
this.colors = createInstancedAttribute(gl, this.program, 'a_color', 4, gl.UNSIGNED_BYTE, true);
|
|
28
22
|
gl.bindVertexArray(null);
|
|
29
23
|
}
|
|
30
24
|
setResolution(width, height) {
|
|
@@ -35,9 +29,12 @@ export class ScatterWebGLProgram {
|
|
|
35
29
|
gl.uniform2f(gl.getUniformLocation(this.program, 'u_resolution'), width, height);
|
|
36
30
|
}
|
|
37
31
|
plot(plotData) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
this
|
|
32
|
+
const {
|
|
33
|
+
gl
|
|
34
|
+
} = this;
|
|
35
|
+
uploadGrowableBuffer(gl, this.centers.buffer, plotData.centers);
|
|
36
|
+
uploadGrowableBuffer(gl, this.sizes.buffer, plotData.sizes);
|
|
37
|
+
uploadGrowableBuffer(gl, this.colors.buffer, plotData.colors);
|
|
41
38
|
}
|
|
42
39
|
render(plotData) {
|
|
43
40
|
if (plotData.pointCount === 0) {
|
|
@@ -58,65 +55,10 @@ export class ScatterWebGLProgram {
|
|
|
58
55
|
} = this;
|
|
59
56
|
gl.deleteProgram(this.program);
|
|
60
57
|
gl.deleteVertexArray(this.vao);
|
|
61
|
-
gl.deleteBuffer(this.centers.buffer);
|
|
62
|
-
gl.deleteBuffer(this.sizes.buffer);
|
|
63
|
-
gl.deleteBuffer(this.colors.buffer);
|
|
58
|
+
gl.deleteBuffer(this.centers.buffer.buffer);
|
|
59
|
+
gl.deleteBuffer(this.sizes.buffer.buffer);
|
|
60
|
+
gl.deleteBuffer(this.colors.buffer.buffer);
|
|
64
61
|
gl.deleteBuffer(this.quadBuffer);
|
|
65
62
|
this.shaders.forEach(shader => gl.deleteShader(shader));
|
|
66
63
|
}
|
|
67
|
-
|
|
68
|
-
// Assumes the owning VAO (Vertex Array Object) is already bound.
|
|
69
|
-
setupInstancedAttribute(name, size, glType, normalized) {
|
|
70
|
-
const {
|
|
71
|
-
gl,
|
|
72
|
-
program
|
|
73
|
-
} = this;
|
|
74
|
-
const buffer = gl.createBuffer();
|
|
75
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
76
|
-
const location = gl.getAttribLocation(program, name);
|
|
77
|
-
gl.enableVertexAttribArray(location);
|
|
78
|
-
gl.vertexAttribPointer(location, size, glType, normalized, 0, 0);
|
|
79
|
-
gl.vertexAttribDivisor(location, 1);
|
|
80
|
-
return {
|
|
81
|
-
buffer,
|
|
82
|
-
size,
|
|
83
|
-
glType,
|
|
84
|
-
capacityBytes: 0,
|
|
85
|
-
lastUploaded: null
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
uploadBuffer(target, data) {
|
|
89
|
-
if (target.lastUploaded === data) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
const {
|
|
93
|
-
gl
|
|
94
|
-
} = this;
|
|
95
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, target.buffer);
|
|
96
|
-
if (data.byteLength <= target.capacityBytes) {
|
|
97
|
-
gl.bufferSubData(gl.ARRAY_BUFFER, 0, data);
|
|
98
|
-
} else {
|
|
99
|
-
gl.bufferData(gl.ARRAY_BUFFER, data, gl.DYNAMIC_DRAW);
|
|
100
|
-
target.capacityBytes = data.byteLength;
|
|
101
|
-
}
|
|
102
|
-
target.lastUploaded = data;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
function initializeProgram(gl, vertexShaderSource, fragmentShaderSource) {
|
|
106
|
-
const program = gl.createProgram();
|
|
107
|
-
const vertexShader = compileShader(gl, vertexShaderSource, gl.VERTEX_SHADER);
|
|
108
|
-
const fragmentShader = compileShader(gl, fragmentShaderSource, gl.FRAGMENT_SHADER);
|
|
109
|
-
gl.attachShader(program, vertexShader);
|
|
110
|
-
gl.attachShader(program, fragmentShader);
|
|
111
|
-
gl.linkProgram(program);
|
|
112
|
-
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
|
|
113
|
-
console.error(`Program linking failed: ${gl.getProgramInfoLog(program)}`);
|
|
114
|
-
console.error(`Vertex shader info-log: ${gl.getShaderInfoLog(vertexShader)}`);
|
|
115
|
-
console.error(`Fragment shader info-log: ${gl.getShaderInfoLog(fragmentShader)}`);
|
|
116
|
-
}
|
|
117
|
-
return {
|
|
118
|
-
program,
|
|
119
|
-
vertexShader,
|
|
120
|
-
fragmentShader
|
|
121
|
-
};
|
|
122
64
|
}
|
package/index.js
CHANGED
package/index.mjs
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { GeoProjection } from '@mui/x-charts-vendor/d3-geo';
|
|
2
|
+
/**
|
|
3
|
+
* Builds a test that maps a device pixel to its `[lon, lat]`, or `null` when the
|
|
4
|
+
* pixel is not part of the visible map. It combines two clips that `projection.invert`
|
|
5
|
+
* alone misses:
|
|
6
|
+
*
|
|
7
|
+
* - the **post-clip** (cartesian) stream rejects device pixels outside the clip
|
|
8
|
+
* rectangle — relevant once the map is panned/zoomed with a `clipExtent`;
|
|
9
|
+
* - streaming the inverted coordinate **back** through the projection applies the
|
|
10
|
+
* pre-clip (spherical) boundary and checks the round trip: azimuthal projections
|
|
11
|
+
* clamp `invert` outside the visible disk to the limb, and those clamped points do
|
|
12
|
+
* not project back to the pixel they came from.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createGetVisibleCoordinate(projection: GeoProjection): ([deviceX, deviceY]: [number, number]) => [number, number] | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { GeoProjection } from '@mui/x-charts-vendor/d3-geo';
|
|
2
|
+
/**
|
|
3
|
+
* Builds a test that maps a device pixel to its `[lon, lat]`, or `null` when the
|
|
4
|
+
* pixel is not part of the visible map. It combines two clips that `projection.invert`
|
|
5
|
+
* alone misses:
|
|
6
|
+
*
|
|
7
|
+
* - the **post-clip** (cartesian) stream rejects device pixels outside the clip
|
|
8
|
+
* rectangle — relevant once the map is panned/zoomed with a `clipExtent`;
|
|
9
|
+
* - streaming the inverted coordinate **back** through the projection applies the
|
|
10
|
+
* pre-clip (spherical) boundary and checks the round trip: azimuthal projections
|
|
11
|
+
* clamp `invert` outside the visible disk to the limb, and those clamped points do
|
|
12
|
+
* not project back to the pixel they came from.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createGetVisibleCoordinate(projection: GeoProjection): ([deviceX, deviceY]: [number, number]) => [number, number] | null;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createGetVisibleCoordinate = createGetVisibleCoordinate;
|
|
7
|
+
// A `GeoStream` sink that only records whether a point passed through (and where),
|
|
8
|
+
// so a projection/clip pipeline can be probed one point at a time.
|
|
9
|
+
|
|
10
|
+
function createPointSink() {
|
|
11
|
+
const sink = {
|
|
12
|
+
hit: false,
|
|
13
|
+
x: 0,
|
|
14
|
+
y: 0,
|
|
15
|
+
point(x, y) {
|
|
16
|
+
sink.hit = true;
|
|
17
|
+
sink.x = x;
|
|
18
|
+
sink.y = y;
|
|
19
|
+
},
|
|
20
|
+
lineStart() {},
|
|
21
|
+
lineEnd() {},
|
|
22
|
+
polygonStart() {},
|
|
23
|
+
polygonEnd() {}
|
|
24
|
+
};
|
|
25
|
+
return sink;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Builds a test that maps a device pixel to its `[lon, lat]`, or `null` when the
|
|
30
|
+
* pixel is not part of the visible map. It combines two clips that `projection.invert`
|
|
31
|
+
* alone misses:
|
|
32
|
+
*
|
|
33
|
+
* - the **post-clip** (cartesian) stream rejects device pixels outside the clip
|
|
34
|
+
* rectangle — relevant once the map is panned/zoomed with a `clipExtent`;
|
|
35
|
+
* - streaming the inverted coordinate **back** through the projection applies the
|
|
36
|
+
* pre-clip (spherical) boundary and checks the round trip: azimuthal projections
|
|
37
|
+
* clamp `invert` outside the visible disk to the limb, and those clamped points do
|
|
38
|
+
* not project back to the pixel they came from.
|
|
39
|
+
*/
|
|
40
|
+
function createGetVisibleCoordinate(projection) {
|
|
41
|
+
const invert = projection.invert;
|
|
42
|
+
const forwardSink = createPointSink();
|
|
43
|
+
const forwardStream = projection.stream(forwardSink);
|
|
44
|
+
const postClip = projection.postclip?.();
|
|
45
|
+
const clipSink = createPointSink();
|
|
46
|
+
const clipStream = postClip?.(clipSink);
|
|
47
|
+
return ([deviceX, deviceY]) => {
|
|
48
|
+
if (clipStream) {
|
|
49
|
+
clipSink.hit = false;
|
|
50
|
+
clipStream.point(deviceX, deviceY);
|
|
51
|
+
if (!clipSink.hit) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const coordinates = invert([deviceX, deviceY]);
|
|
56
|
+
if (!coordinates) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
forwardSink.hit = false;
|
|
60
|
+
forwardStream.point(coordinates[0], coordinates[1]);
|
|
61
|
+
if (!forwardSink.hit || Math.abs(forwardSink.x - deviceX) > 0.5 || Math.abs(forwardSink.y - deviceY) > 0.5) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
return coordinates;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// A `GeoStream` sink that only records whether a point passed through (and where),
|
|
2
|
+
// so a projection/clip pipeline can be probed one point at a time.
|
|
3
|
+
|
|
4
|
+
function createPointSink() {
|
|
5
|
+
const sink = {
|
|
6
|
+
hit: false,
|
|
7
|
+
x: 0,
|
|
8
|
+
y: 0,
|
|
9
|
+
point(x, y) {
|
|
10
|
+
sink.hit = true;
|
|
11
|
+
sink.x = x;
|
|
12
|
+
sink.y = y;
|
|
13
|
+
},
|
|
14
|
+
lineStart() {},
|
|
15
|
+
lineEnd() {},
|
|
16
|
+
polygonStart() {},
|
|
17
|
+
polygonEnd() {}
|
|
18
|
+
};
|
|
19
|
+
return sink;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Builds a test that maps a device pixel to its `[lon, lat]`, or `null` when the
|
|
24
|
+
* pixel is not part of the visible map. It combines two clips that `projection.invert`
|
|
25
|
+
* alone misses:
|
|
26
|
+
*
|
|
27
|
+
* - the **post-clip** (cartesian) stream rejects device pixels outside the clip
|
|
28
|
+
* rectangle — relevant once the map is panned/zoomed with a `clipExtent`;
|
|
29
|
+
* - streaming the inverted coordinate **back** through the projection applies the
|
|
30
|
+
* pre-clip (spherical) boundary and checks the round trip: azimuthal projections
|
|
31
|
+
* clamp `invert` outside the visible disk to the limb, and those clamped points do
|
|
32
|
+
* not project back to the pixel they came from.
|
|
33
|
+
*/
|
|
34
|
+
export function createGetVisibleCoordinate(projection) {
|
|
35
|
+
const invert = projection.invert;
|
|
36
|
+
const forwardSink = createPointSink();
|
|
37
|
+
const forwardStream = projection.stream(forwardSink);
|
|
38
|
+
const postClip = projection.postclip?.();
|
|
39
|
+
const clipSink = createPointSink();
|
|
40
|
+
const clipStream = postClip?.(clipSink);
|
|
41
|
+
return ([deviceX, deviceY]) => {
|
|
42
|
+
if (clipStream) {
|
|
43
|
+
clipSink.hit = false;
|
|
44
|
+
clipStream.point(deviceX, deviceY);
|
|
45
|
+
if (!clipSink.hit) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const coordinates = invert([deviceX, deviceY]);
|
|
50
|
+
if (!coordinates) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
forwardSink.hit = false;
|
|
54
|
+
forwardStream.point(coordinates[0], coordinates[1]);
|
|
55
|
+
if (!forwardSink.hit || Math.abs(forwardSink.x - deviceX) > 0.5 || Math.abs(forwardSink.y - deviceY) > 0.5) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
return coordinates;
|
|
59
|
+
};
|
|
60
|
+
}
|