@nextgis/ngw-map 1.18.0 → 1.18.1

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,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-map; version: 1.18.0; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 1.18.1; author: NextGIS */
2
2
  import { EventEmitter } from 'events';
3
3
  import CancelablePromise from '@nextgis/cancelable-promise';
4
4
  import { deepmerge, deprecatedWarn, defined, isObject, getIdentifyRadius } from '@nextgis/utils';
@@ -1,4 +1,4 @@
1
- /** Bundle of @nextgis/ngw-map; version: 1.18.0; author: NextGIS */
1
+ /** Bundle of @nextgis/ngw-map; version: 1.18.1; author: NextGIS */
2
2
  var NgwMap = (function (exports) {
3
3
  'use strict';
4
4
 
@@ -2140,32 +2140,46 @@ var NgwMap = (function (exports) {
2140
2140
  return mask;
2141
2141
  };
2142
2142
  }
2143
- function expressionCallback(paint, defaultPaint, getPaintFunctions) {
2143
+ function expressionCallback(_a) {
2144
+ var paint = _a.paint, defaultPaint = _a.defaultPaint;
2144
2145
  var expressionCallback = createExpressionCallback(paint);
2145
2146
  if (expressionCallback) {
2146
2147
  var expressionPaintCb = function (feature) {
2147
- return preparePaint(expressionCallback(feature), defaultPaint, getPaintFunctions);
2148
+ return preparePaint({
2149
+ paint: expressionCallback(feature),
2150
+ defaultPaint: defaultPaint,
2151
+ });
2148
2152
  };
2149
- expressionPaintCb.paint = paint;
2153
+ expressionPaintCb.paint = finalizePaint({ paint: paint, defaultPaint: defaultPaint });
2150
2154
  return expressionPaintCb;
2151
2155
  }
2156
+ return finalizePaint({ paint: paint, defaultPaint: defaultPaint });
2157
+ }
2158
+ function finalizePaint(_a) {
2159
+ var _b;
2160
+ var paint = _a.paint, defaultPaint = _a.defaultPaint;
2152
2161
  var newPaint = __assign({}, defaultPaint);
2153
2162
  newPaint = __assign(__assign({}, newPaint), paint);
2154
- newPaint.fill = newPaint.fill !== undefined ? newPaint.fill : true;
2163
+ newPaint.fill = (_b = newPaint.fill) !== null && _b !== void 0 ? _b : true;
2155
2164
  newPaint.stroke =
2156
2165
  newPaint.stroke !== undefined
2157
2166
  ? newPaint.stroke
2158
2167
  : !newPaint.fill || !!(newPaint.strokeColor || newPaint.strokeOpacity);
2159
2168
  return newPaint;
2160
2169
  }
2161
- function preparePaint(paint, defaultPaint, getPaintFunctions) {
2170
+ function preparePaint(_a) {
2171
+ var paint = _a.paint, defaultPaint = _a.defaultPaint, getPaintFunctions = _a.getPaintFunctions;
2162
2172
  if (!paint) {
2163
2173
  throw new Error('paint is empty');
2164
2174
  }
2165
2175
  var newPaint = __assign({}, defaultPaint);
2166
2176
  if (isPaintCallback(paint)) {
2167
2177
  var getPaintFunction = function (feature) {
2168
- var getPaint = preparePaint(paint(feature), defaultPaint, getPaintFunctions);
2178
+ var getPaint = preparePaint({
2179
+ paint: paint(feature),
2180
+ defaultPaint: defaultPaint,
2181
+ getPaintFunctions: getPaintFunctions,
2182
+ });
2169
2183
  getPaint.type = paint.type;
2170
2184
  return getPaint;
2171
2185
  };
@@ -2174,20 +2188,28 @@ var NgwMap = (function (exports) {
2174
2188
  }
2175
2189
  else if (isPropertiesPaint(paint)) {
2176
2190
  return function (feature) {
2177
- return preparePaint(createPropertiesPaint(paint)(feature), defaultPaint, getPaintFunctions);
2191
+ return preparePaint({
2192
+ paint: createPropertiesPaint(paint)(feature),
2193
+ defaultPaint: defaultPaint,
2194
+ getPaintFunctions: getPaintFunctions,
2195
+ });
2178
2196
  };
2179
2197
  }
2180
2198
  else if (paint.type === 'get-paint') {
2181
2199
  var getPaint = updatePaintOptionFromCallback(paint, getPaintFunctions);
2182
2200
  if (getPaint) {
2183
- newPaint = preparePaint(getPaint, defaultPaint, getPaintFunctions);
2201
+ newPaint = preparePaint({
2202
+ paint: getPaint,
2203
+ defaultPaint: defaultPaint,
2204
+ getPaintFunctions: getPaintFunctions,
2205
+ });
2184
2206
  }
2185
2207
  }
2186
2208
  else if (paint.type === 'icon') {
2187
2209
  return paint;
2188
2210
  }
2189
2211
  else {
2190
- newPaint = expressionCallback(paint, defaultPaint, getPaintFunctions);
2212
+ newPaint = expressionCallback({ paint: paint, defaultPaint: defaultPaint });
2191
2213
  }
2192
2214
  if (isPaintCallback(newPaint)) {
2193
2215
  return newPaint;
@@ -3943,10 +3965,18 @@ var NgwMap = (function (exports) {
3943
3965
  };
3944
3966
  if (!options.nativePaint) {
3945
3967
  if (this.options.paint) {
3946
- options.paint = preparePaint(options.paint || {}, this.options.paint, this.getPaintFunctions);
3968
+ options.paint = preparePaint({
3969
+ paint: options.paint || {},
3970
+ defaultPaint: this.options.paint,
3971
+ getPaintFunctions: this.getPaintFunctions,
3972
+ });
3947
3973
  }
3948
3974
  if (options.selectedPaint && this.options.selectedPaint) {
3949
- options.selectedPaint = preparePaint(options.selectedPaint, this.options.selectedPaint, this.getPaintFunctions);
3975
+ options.selectedPaint = preparePaint({
3976
+ paint: options.selectedPaint,
3977
+ defaultPaint: this.options.selectedPaint,
3978
+ getPaintFunctions: this.getPaintFunctions,
3979
+ });
3950
3980
  }
3951
3981
  }
3952
3982
  };