@evergis/react 2.0.136 → 2.0.137

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.
@@ -1,9 +1,10 @@
1
- import { CirclePointSymbolDc, CompositeSymbolDc, H3GridSymbolDc, ImagePointSymbolDc, MaskedImagePointSymbolDc, PolygonSymbolDc, PolylineSymbolDc, RasterSymbolDc, SimplePolylineSymbolDc, SquarePointSymbolDc, StyleDc } from '@evergis/api';
1
+ import { CirclePointSymbolDc, CompositeSymbolDc, H3GridSymbolDc, ImagePointSymbolDc, MaskedImagePointSymbolDc, PolygonSymbolDc, PolylineSymbolDc, RasterSymbolDc, SimplePolylineSymbolDc, SquarePointSymbolDc, StyleDc, SvgPointSymbolDc } from '@evergis/api';
2
2
  import { LabelType } from './label';
3
3
  import { CalculatedAble } from './parameterValue';
4
4
  import { ClientSymbol } from './utils';
5
5
  import { FillBrushType, StrokeBrushType } from './brush';
6
6
  export declare type PointSymbol = ClientSymbol<'circlePointSymbol', CirclePointSymbolDc>;
7
+ export declare type SvgPointSymbol = ClientSymbol<'svgPointSymbol', SvgPointSymbolDc>;
7
8
  export declare type SquareSymbol = ClientSymbol<'squarePointSymbol', SquarePointSymbolDc> & {
8
9
  angle?: CalculatedAble<number>;
9
10
  };
@@ -8,5 +8,5 @@ export interface UseSymbolParams {
8
8
  size?: number;
9
9
  maxWidth?: number;
10
10
  }
11
- export declare const DEFAULT_SYMBOL_SIZE = 16;
11
+ export declare const DEFAULT_SYMBOL_SIZE = 26;
12
12
  export declare function useSymbol({ symbol, size, render, maxWidth, }: UseSymbolParams, canvasRef: MutableRefObject<Canvas | null>): void;
@@ -2802,7 +2802,7 @@ const h3gridFeature = /*#__PURE__*/new H3Feature.H3Feature([[50, -15], [80, -33]
2802
2802
  const lineLegendFeature = /*#__PURE__*/new Polyline.Polyline([[0, -50], [100, -50]], {
2803
2803
  crs: Crs.plain
2804
2804
  });
2805
- const polygonLegendFeature = /*#__PURE__*/new Polygon.Polygon([[0, 0], [100, 0], [100, -100], [0, -100]], {
2805
+ const polygonLegendFeature = /*#__PURE__*/new Polygon.Polygon([[20, -20], [80, -20], [80, -80], [20, -80]], {
2806
2806
  crs: Crs.plain
2807
2807
  });
2808
2808
  const polygonMapLegendFeature = /*#__PURE__*/new Polygon.Polygon([[50, 0], [100, -25], [100, -75], [50, -100], [0, -75], [0, -25]], {
@@ -2812,6 +2812,7 @@ const MAP_LEGEND_FEATURES = {
2812
2812
  polygon: polygonMapLegendFeature
2813
2813
  };
2814
2814
  const LEGEND_FEATURES = {
2815
+ point: pointFeature,
2815
2816
  polyline: lineLegendFeature,
2816
2817
  polygon: polygonLegendFeature,
2817
2818
  h3grid: h3gridFeature
@@ -2876,6 +2877,9 @@ function deserializeSymbol(symbol) {
2876
2877
  case "h3grid":
2877
2878
  return deserializeH3Symbol(symbol);
2878
2879
 
2880
+ case "svgPointSymbol":
2881
+ return deserializeSvgPointSymbol(symbol);
2882
+
2879
2883
  case 'circlePointSymbol':
2880
2884
  return deserializePointSymbol(symbol);
2881
2885
 
@@ -2916,6 +2920,41 @@ function deserializePointSymbol(symbol) {
2916
2920
  return new Point.PointSymbol(deserializePointSymbolParams(symbol));
2917
2921
  }
2918
2922
 
2923
+ const getOffsetParameterValue = offset => [getParameterValue(offset == null ? void 0 : offset[0]), getParameterValue(offset == null ? void 0 : offset[1])];
2924
+
2925
+ function deserializeSvgPointSymbolParams(_ref) {
2926
+ let {
2927
+ type,
2928
+ data,
2929
+ size,
2930
+ offset,
2931
+ angle,
2932
+ background,
2933
+ figure
2934
+ } = _ref;
2935
+ return _extends({
2936
+ type: getParameterValue(type),
2937
+ data: getParameterValue(data),
2938
+ size: getParameterValue(size),
2939
+ offset: getOffsetParameterValue(offset),
2940
+ angle: getParameterValue(angle)
2941
+ }, background ? {
2942
+ background: _extends({}, background, {
2943
+ fillColor: deserializeColor(getParameterValue(background == null ? void 0 : background.fillColor)),
2944
+ strokeColor: deserializeColor(getParameterValue(background == null ? void 0 : background.strokeColor)),
2945
+ strokeWidth: getParameterValue(background == null ? void 0 : background.strokeWidth)
2946
+ })
2947
+ } : {}, figure ? {
2948
+ figure: _extends({}, figure, {
2949
+ fillColor: deserializeColor(getParameterValue(figure == null ? void 0 : figure.fillColor))
2950
+ })
2951
+ } : {});
2952
+ }
2953
+
2954
+ function deserializeSvgPointSymbol(symbol) {
2955
+ return new Point.PointSymbol(deserializeSvgPointSymbolParams(symbol));
2956
+ }
2957
+
2919
2958
  function deserializeSquareSymbol(symbol) {
2920
2959
  return new Square.SquareSymbol(_extends({}, deserializePointSymbolParams(symbol), {
2921
2960
  // @ts-ignore
@@ -2973,14 +3012,14 @@ function deserializePolylineSymbol(symbol) {
2973
3012
  return new SGisPolylineSymbol(symbol);
2974
3013
  }
2975
3014
 
2976
- function deserializePointSymbolParams(_ref) {
3015
+ function deserializePointSymbolParams(_ref2) {
2977
3016
  let {
2978
3017
  size,
2979
3018
  offset,
2980
3019
  strokeColor,
2981
3020
  strokeWidth,
2982
3021
  fillColor
2983
- } = _ref;
3022
+ } = _ref2;
2984
3023
  return {
2985
3024
  size: getParameterValue(size),
2986
3025
  offset: deserializeAnchor(offset),
@@ -3439,7 +3478,7 @@ const useLegendValueSymbol = _ref => {
3439
3478
  });
3440
3479
  };
3441
3480
 
3442
- const DEFAULT_SYMBOL_SIZE = 16;
3481
+ const DEFAULT_SYMBOL_SIZE = 26;
3443
3482
  function useSymbol(_ref, canvasRef) {
3444
3483
  let {
3445
3484
  symbol,
@@ -4688,7 +4727,7 @@ var _templateObject$2, _templateObject2$1, _templateObject3$1, _templateObject4$
4688
4727
  const LegendContainer = /*#__PURE__*/styled__default.div(_templateObject$2 || (_templateObject$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background-color: white;\n"])));
4689
4728
  const LegendSectionContainer = /*#__PURE__*/styled__default.div(_templateObject2$1 || (_templateObject2$1 = /*#__PURE__*/_taggedTemplateLiteralLoose([""])));
4690
4729
  const LegendSymbolTitle = /*#__PURE__*/styled__default.p(_templateObject3$1 || (_templateObject3$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin: 0;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n"])));
4691
- const LegendValueContainer = /*#__PURE__*/styled__default.div(_templateObject4$1 || (_templateObject4$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n font-size: 0.75rem;\n padding: 0.125rem 0;\n\n ", " {\n padding-left: 0.5rem;\n }\n"])), LegendSymbolTitle);
4730
+ const LegendValueContainer = /*#__PURE__*/styled__default.div(_templateObject4$1 || (_templateObject4$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n font-size: 0.75rem;\n\n ", " {\n padding-left: 0.5rem;\n }\n"])), LegendSymbolTitle);
4692
4731
  const LegendSectionHeader = /*#__PURE__*/styled__default.div(_templateObject5$1 || (_templateObject5$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-size: 0.75rem;\n font-weight: 500;\n"])));
4693
4732
 
4694
4733
  const LegendSection = _ref => {
@@ -4752,7 +4791,7 @@ const LegendValue = _ref => {
4752
4791
  })), React__default.createElement(LegendSymbolTitle, null, value.title));
4753
4792
  };
4754
4793
 
4755
- const MAX_SIZE$1 = 16;
4794
+ const MAX_SIZE$1 = 26;
4756
4795
 
4757
4796
  const getNumberParam = (parameterValue, param) => {
4758
4797
  return typeof parameterValue === 'object' && param in parameterValue && typeof parameterValue[param] === 'number' ? parameterValue[param] : null;
@@ -4956,7 +4995,7 @@ const Fullscreen = () => {
4956
4995
 
4957
4996
  var _templateObject$6, _templateObject2$5, _templateObject3$5, _templateObject4$4, _templateObject5$4, _templateObject6$2, _templateObject7$2, _templateObject8$2, _templateObject9$1, _templateObject10$1, _templateObject11$1;
4958
4997
  const MapLegendControl = /*#__PURE__*/styled__default(MapControl)(_templateObject$6 || (_templateObject$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n cursor: default;\n"])));
4959
- const MapLegendContainer = /*#__PURE__*/styled__default.div(_templateObject2$5 || (_templateObject2$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n width: 12.5rem;\n box-sizing: border-box;\n\n canvas {\n height: 1rem;\n width: 1rem;\n }\n"])));
4998
+ const MapLegendContainer = /*#__PURE__*/styled__default.div(_templateObject2$5 || (_templateObject2$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n justify-content: space-between;\n width: 12.5rem;\n box-sizing: border-box;\n\n canvas {\n height: 1.625rem;\n width: 1.625rem;\n }\n"])));
4960
4999
  const MapLegendHeader = /*#__PURE__*/styled__default(LegendSectionHeader)(_templateObject3$5 || (_templateObject3$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n max-width: 15rem;\n margin-bottom: 0.25rem;\n font-weight: 500;\n"])));
4961
5000
  const MapLegendValueDescr = /*#__PURE__*/styled__default.div(_templateObject4$4 || (_templateObject4$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-bottom: 0.25rem;\n font-size: 0.75rem;\n font-weight: 500;\n"])));
4962
5001
  const MapLegendItems = /*#__PURE__*/styled__default.div(_templateObject5$4 || (_templateObject5$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n width: 100%;\n border-radius: 0.125rem;\n"])));