@nextgis/ngw-map 1.8.0 → 1.8.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.
- package/lib/ngw-map.cjs.js +1 -1
- package/lib/ngw-map.esm-browser.js +94 -30
- package/lib/ngw-map.esm-browser.js.map +1 -1
- package/lib/ngw-map.esm-browser.prod.js +1 -1
- package/lib/ngw-map.esm-browser.prod.js.map +1 -1
- package/lib/ngw-map.esm-bundler.js +1 -1
- package/lib/ngw-map.global.js +120 -34
- package/lib/ngw-map.global.js.map +1 -1
- package/lib/ngw-map.global.prod.js +1 -1
- package/lib/ngw-map.global.prod.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-map; version: 1.8.
|
|
1
|
+
/** Bundle of @nextgis/ngw-map; version: 1.8.1; author: NextGIS */
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
import CancelablePromise from '@nextgis/cancelable-promise';
|
|
4
4
|
import { deepmerge, deprecatedWarn, defined, isObject } from '@nextgis/utils';
|
package/lib/ngw-map.global.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Bundle of @nextgis/ngw-map; version: 1.8.
|
|
1
|
+
/** Bundle of @nextgis/ngw-map; version: 1.8.1; author: NextGIS */
|
|
2
2
|
var NgwMap = (function (exports) {
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -5803,6 +5803,9 @@ var NgwMap = (function (exports) {
|
|
|
5803
5803
|
BaseProperty.prototype.getParent = function () {
|
|
5804
5804
|
return this.item.tree.getParent();
|
|
5805
5805
|
};
|
|
5806
|
+
BaseProperty.prototype.getChildren = function () {
|
|
5807
|
+
return this.item.tree.getChildren();
|
|
5808
|
+
};
|
|
5806
5809
|
BaseProperty.prototype.isGroup = function () {
|
|
5807
5810
|
var children = this.item.tree.getDescendants();
|
|
5808
5811
|
return children.length;
|
|
@@ -5923,6 +5926,26 @@ var NgwMap = (function (exports) {
|
|
|
5923
5926
|
return property && property.get();
|
|
5924
5927
|
}));
|
|
5925
5928
|
};
|
|
5929
|
+
CheckProperty.prototype.block = function (options) {
|
|
5930
|
+
this._blocked = true;
|
|
5931
|
+
this._block(options);
|
|
5932
|
+
};
|
|
5933
|
+
CheckProperty.prototype.unBlock = function (options) {
|
|
5934
|
+
this._blocked = false;
|
|
5935
|
+
if (this.getValue()) {
|
|
5936
|
+
this._unBlock(options);
|
|
5937
|
+
}
|
|
5938
|
+
};
|
|
5939
|
+
CheckProperty.prototype.blockChild = function (options) {
|
|
5940
|
+
var _this = this;
|
|
5941
|
+
this.item.tree
|
|
5942
|
+
.getDescendants()
|
|
5943
|
+
.forEach(function (x) { return _this._blockChild(x, options); });
|
|
5944
|
+
};
|
|
5945
|
+
CheckProperty.prototype.unblockChild = function (options) {
|
|
5946
|
+
var _this = this;
|
|
5947
|
+
this.item.tree.getChildren().forEach(function (x) { return _this._unBlockChild(x, options); });
|
|
5948
|
+
};
|
|
5926
5949
|
CheckProperty.prototype._prepareValue = function (value) {
|
|
5927
5950
|
return value;
|
|
5928
5951
|
};
|
|
@@ -5944,32 +5967,12 @@ var NgwMap = (function (exports) {
|
|
|
5944
5967
|
this.unblockChild(options);
|
|
5945
5968
|
}
|
|
5946
5969
|
};
|
|
5947
|
-
CheckProperty.prototype.block = function (options) {
|
|
5948
|
-
this._blocked = true;
|
|
5949
|
-
this._block(options);
|
|
5950
|
-
};
|
|
5951
5970
|
CheckProperty.prototype._block = function (options) {
|
|
5952
5971
|
this._turnOff(options);
|
|
5953
5972
|
};
|
|
5954
|
-
CheckProperty.prototype.unBlock = function (options) {
|
|
5955
|
-
this._blocked = false;
|
|
5956
|
-
if (this.getValue()) {
|
|
5957
|
-
this._unBlock(options);
|
|
5958
|
-
}
|
|
5959
|
-
};
|
|
5960
5973
|
CheckProperty.prototype._unBlock = function (options) {
|
|
5961
5974
|
this._turnOn(options);
|
|
5962
5975
|
};
|
|
5963
|
-
CheckProperty.prototype.blockChild = function (options) {
|
|
5964
|
-
var _this = this;
|
|
5965
|
-
this.item.tree
|
|
5966
|
-
.getDescendants()
|
|
5967
|
-
.forEach(function (x) { return _this._blockChild(x, options); });
|
|
5968
|
-
};
|
|
5969
|
-
CheckProperty.prototype.unblockChild = function (options) {
|
|
5970
|
-
var _this = this;
|
|
5971
|
-
this.item.tree.getChildren().forEach(function (x) { return _this._unBlockChild(x, options); });
|
|
5972
|
-
};
|
|
5973
5976
|
CheckProperty.prototype._blockChild = function (item, options) {
|
|
5974
5977
|
var prop = item.properties &&
|
|
5975
5978
|
item.properties.property(this.name);
|
|
@@ -6025,22 +6028,22 @@ var NgwMap = (function (exports) {
|
|
|
6025
6028
|
};
|
|
6026
6029
|
ItemProperties.prototype._setPropertyHandler = function (propOpt) {
|
|
6027
6030
|
var handlers = ItemProperties.handlers;
|
|
6028
|
-
var
|
|
6029
|
-
if (!
|
|
6031
|
+
var Handler = propOpt.handler;
|
|
6032
|
+
if (!Handler && propOpt.type) {
|
|
6030
6033
|
switch (propOpt.type) {
|
|
6031
6034
|
case 'boolean':
|
|
6032
|
-
|
|
6035
|
+
Handler = handlers.CheckProperty;
|
|
6033
6036
|
break;
|
|
6034
6037
|
case 'string':
|
|
6035
|
-
|
|
6038
|
+
Handler = handlers.BaseProperty;
|
|
6036
6039
|
break;
|
|
6037
6040
|
default:
|
|
6038
|
-
|
|
6041
|
+
Handler = handlers.BaseProperty;
|
|
6039
6042
|
}
|
|
6040
6043
|
}
|
|
6041
|
-
if (
|
|
6044
|
+
if (Handler && propOpt.name) {
|
|
6042
6045
|
var options = __assign({}, (propOpt || {}));
|
|
6043
|
-
this._properties[propOpt.name] = new
|
|
6046
|
+
this._properties[propOpt.name] = new Handler(propOpt.name, this.item, options);
|
|
6044
6047
|
this._propertiesList.push(propOpt.name);
|
|
6045
6048
|
}
|
|
6046
6049
|
};
|
|
@@ -6099,6 +6102,62 @@ var NgwMap = (function (exports) {
|
|
|
6099
6102
|
return Item;
|
|
6100
6103
|
}());
|
|
6101
6104
|
|
|
6105
|
+
var WebmapLayerOpacityPropertyHandler = /** @class */ (function (_super) {
|
|
6106
|
+
__extends(WebmapLayerOpacityPropertyHandler, _super);
|
|
6107
|
+
function WebmapLayerOpacityPropertyHandler() {
|
|
6108
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
6109
|
+
}
|
|
6110
|
+
WebmapLayerOpacityPropertyHandler.prototype.getProperty = function () {
|
|
6111
|
+
var layer = this.item.layer;
|
|
6112
|
+
if (layer) {
|
|
6113
|
+
return layer && layer.options && layer.options.opacity !== undefined
|
|
6114
|
+
? layer.options.opacity
|
|
6115
|
+
: 1;
|
|
6116
|
+
}
|
|
6117
|
+
return 1;
|
|
6118
|
+
};
|
|
6119
|
+
WebmapLayerOpacityPropertyHandler.prototype.update = function (value, options) {
|
|
6120
|
+
var _this = this;
|
|
6121
|
+
options = options || {};
|
|
6122
|
+
if (this.isGroup()) {
|
|
6123
|
+
this._value = this._prepareValue(value, options);
|
|
6124
|
+
var children = this.getChildren();
|
|
6125
|
+
for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
|
|
6126
|
+
var child = children_1[_i];
|
|
6127
|
+
var property = child.properties.property(this.name);
|
|
6128
|
+
if (property) {
|
|
6129
|
+
if (options.propagation) {
|
|
6130
|
+
property.set(value, options);
|
|
6131
|
+
}
|
|
6132
|
+
else {
|
|
6133
|
+
property.update(property.get(), options);
|
|
6134
|
+
}
|
|
6135
|
+
}
|
|
6136
|
+
}
|
|
6137
|
+
}
|
|
6138
|
+
var layer = this.item.layer;
|
|
6139
|
+
if (layer) {
|
|
6140
|
+
var parents = this.getParents();
|
|
6141
|
+
var coef = parents.reduce(function (s, x) {
|
|
6142
|
+
var prop = x.properties.property(_this.name);
|
|
6143
|
+
var multiplier = prop ? prop.getValue() : 1;
|
|
6144
|
+
return s * multiplier;
|
|
6145
|
+
}, 1);
|
|
6146
|
+
var val = value * coef;
|
|
6147
|
+
this.item.webMap.setLayerOpacity(layer, this._prepareValue(val));
|
|
6148
|
+
}
|
|
6149
|
+
};
|
|
6150
|
+
WebmapLayerOpacityPropertyHandler.prototype._prepareValue = function (value, options) {
|
|
6151
|
+
if (options && options.propagation && this.isGroup()) {
|
|
6152
|
+
return 1;
|
|
6153
|
+
}
|
|
6154
|
+
// value = Number(value);
|
|
6155
|
+
// return value < 0.1 ? 0.1 : value;
|
|
6156
|
+
return Number(value);
|
|
6157
|
+
};
|
|
6158
|
+
return WebmapLayerOpacityPropertyHandler;
|
|
6159
|
+
}(BaseProperty));
|
|
6160
|
+
|
|
6102
6161
|
var NgwWebmapItem = /** @class */ (function (_super) {
|
|
6103
6162
|
__extends(NgwWebmapItem, _super);
|
|
6104
6163
|
function NgwWebmapItem(webMap, item, options, connector, parent, noInit) {
|
|
@@ -6193,6 +6252,9 @@ var NgwMap = (function (exports) {
|
|
|
6193
6252
|
NgwWebmapItem.prototype.fit = function () {
|
|
6194
6253
|
if (this.item.item_type === 'layer') ;
|
|
6195
6254
|
};
|
|
6255
|
+
NgwWebmapItem.prototype.getLayer = function () {
|
|
6256
|
+
return this.layer;
|
|
6257
|
+
};
|
|
6196
6258
|
NgwWebmapItem.prototype.getItemOptions = function (item) {
|
|
6197
6259
|
var transparency = item.item_type === 'layer' && item.layer_transparency;
|
|
6198
6260
|
var opacity = typeof transparency === 'number' ? (100 - transparency) / 100 : undefined;
|
|
@@ -6296,6 +6358,10 @@ var NgwMap = (function (exports) {
|
|
|
6296
6358
|
}
|
|
6297
6359
|
},
|
|
6298
6360
|
},
|
|
6361
|
+
{
|
|
6362
|
+
name: 'opacity',
|
|
6363
|
+
handler: WebmapLayerOpacityPropertyHandler,
|
|
6364
|
+
},
|
|
6299
6365
|
],
|
|
6300
6366
|
};
|
|
6301
6367
|
return NgwWebmapItem;
|
|
@@ -6524,14 +6590,34 @@ var NgwMap = (function (exports) {
|
|
|
6524
6590
|
delete this._webmapLayersIds;
|
|
6525
6591
|
};
|
|
6526
6592
|
NgwWebmapLayerAdapter.prototype.showLayer = function () {
|
|
6527
|
-
|
|
6528
|
-
this
|
|
6529
|
-
|
|
6593
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6594
|
+
return __generator(this, function (_a) {
|
|
6595
|
+
if (this.layer && this.layer.properties) {
|
|
6596
|
+
return [2 /*return*/, this.layer.properties.property('visibility').set(true)];
|
|
6597
|
+
}
|
|
6598
|
+
return [2 /*return*/];
|
|
6599
|
+
});
|
|
6600
|
+
});
|
|
6530
6601
|
};
|
|
6531
6602
|
NgwWebmapLayerAdapter.prototype.hideLayer = function () {
|
|
6532
|
-
|
|
6533
|
-
this
|
|
6534
|
-
|
|
6603
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6604
|
+
return __generator(this, function (_a) {
|
|
6605
|
+
if (this.layer && this.layer.properties) {
|
|
6606
|
+
return [2 /*return*/, this.layer.properties.property('visibility').set(false)];
|
|
6607
|
+
}
|
|
6608
|
+
return [2 /*return*/];
|
|
6609
|
+
});
|
|
6610
|
+
});
|
|
6611
|
+
};
|
|
6612
|
+
NgwWebmapLayerAdapter.prototype.setOpacity = function (val) {
|
|
6613
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6614
|
+
return __generator(this, function (_a) {
|
|
6615
|
+
if (this.layer && this.layer.properties) {
|
|
6616
|
+
return [2 /*return*/, this.layer.properties.property('opacity').set(val)];
|
|
6617
|
+
}
|
|
6618
|
+
return [2 /*return*/];
|
|
6619
|
+
});
|
|
6620
|
+
});
|
|
6535
6621
|
};
|
|
6536
6622
|
/** @deprecated use {@link NgwWebmapLayerAdapter.getBounds} instead */
|
|
6537
6623
|
NgwWebmapLayerAdapter.prototype.getExtent = function () {
|