@nextgis/webmap
Advanced tools
Comparing version 0.0.3 to 0.0.4
92
index.js
@@ -1168,3 +1168,3 @@ (function (global, factory) { | ||
case 0: | ||
this.options = deepmerge(this.options, options); | ||
this.options = deepmerge(this.options || {}, options); | ||
if (!(!this.settings && this._starterKits.length)) return [3 /*break*/, 2]; | ||
@@ -1207,3 +1207,3 @@ return [4 /*yield*/, this.getSettings()]; | ||
settings = {}; | ||
_i = 0, _a = this._starterKits; | ||
_i = 0, _a = this._starterKits.filter(function (x) { return x.getSettings; }); | ||
_b.label = 3; | ||
@@ -1243,6 +1243,7 @@ case 3: | ||
var _this = this; | ||
this.map.addLayer(provider, Object.assign({}, options, { id: layerName })).then(function (layer) { | ||
return this.map.addLayer(provider, __assign({}, options, { id: layerName }), true).then(function (layer) { | ||
if (layer) { | ||
_this._baseLayers.push(layer.name); | ||
} | ||
return layer; | ||
}); | ||
@@ -1255,19 +1256,28 @@ }; | ||
WebMap.prototype._setupMap = function () { | ||
var _a = this.settings, extent_bottom = _a.extent_bottom, extent_left = _a.extent_left, extent_top = _a.extent_top, extent_right = _a.extent_right; | ||
if (extent_bottom && extent_left && extent_top && extent_right) { | ||
this._extent = [extent_bottom, extent_left, extent_top, extent_right]; | ||
} | ||
var extent = this._extent; | ||
if (extent[3] > 82) { | ||
extent[3] = 82; | ||
} | ||
if (extent[1] < -82) { | ||
extent[1] = -82; | ||
} | ||
this.map.displayProjection = this.displayProjection; | ||
this.map.lonlatProjection = this.lonlatProjection; | ||
this.map.create({ target: this.options.target }); | ||
this._addTreeLayers(); | ||
this._zoomToInitialExtent(); | ||
this.emitter.emit('build-map', this.map); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _a, extent_bottom, extent_left, extent_top, extent_right, extent; | ||
return __generator(this, function (_b) { | ||
if (this.settings) { | ||
_a = this.settings, extent_bottom = _a.extent_bottom, extent_left = _a.extent_left, extent_top = _a.extent_top, extent_right = _a.extent_right; | ||
if (extent_bottom && extent_left && extent_top && extent_right) { | ||
this._extent = [extent_left, extent_bottom, extent_right, extent_top]; | ||
extent = this._extent; | ||
if (extent[3] > 82) { | ||
extent[3] = 82; | ||
} | ||
if (extent[1] < -82) { | ||
extent[1] = -82; | ||
} | ||
} | ||
} | ||
this.map.displayProjection = this.displayProjection; | ||
this.map.lonlatProjection = this.lonlatProjection; | ||
this.map.create({ target: this.options.target }); | ||
this._addTreeLayers(); | ||
this._addLayerProviders(); | ||
this._zoomToInitialExtent(); | ||
this.emitter.emit('build-map', this.map); | ||
return [2 /*return*/]; | ||
}); | ||
}); | ||
}; | ||
@@ -1313,4 +1323,44 @@ WebMap.prototype._addTreeLayers = function () { | ||
// } | ||
this.map.fit(this._extent); | ||
if (this._extent) { | ||
this.map.fit(this._extent); | ||
} | ||
}; | ||
WebMap.prototype._addLayerProviders = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _i, _a, kit, adapters, er_2; | ||
var _this = this; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_b.trys.push([0, 5, , 6]); | ||
_i = 0, _a = this._starterKits.filter(function (x) { return x.getLayerAdapters; }); | ||
_b.label = 1; | ||
case 1: | ||
if (!(_i < _a.length)) return [3 /*break*/, 4]; | ||
kit = _a[_i]; | ||
return [4 /*yield*/, kit.getLayerAdapters.call(kit)]; | ||
case 2: | ||
adapters = _b.sent(); | ||
if (adapters) { | ||
adapters.forEach(function (adapter) { | ||
adapter.createAdapter(_this.map).then(function (newAdapter) { | ||
if (newAdapter) { | ||
_this.map.layerAdapters[adapter.name] = newAdapter; | ||
} | ||
}); | ||
}); | ||
} | ||
_b.label = 3; | ||
case 3: | ||
_i++; | ||
return [3 /*break*/, 1]; | ||
case 4: return [3 /*break*/, 6]; | ||
case 5: | ||
er_2 = _b.sent(); | ||
throw new Error(er_2); | ||
case 6: return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
return WebMap; | ||
@@ -1317,0 +1367,0 @@ }()); |
{ | ||
"name": "@nextgis/webmap", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "", | ||
@@ -8,3 +8,4 @@ "main": "index", | ||
"scripts": { | ||
"build": "rollup -c rollup.config.js" | ||
"build": "rollup -c rollup.config.js", | ||
"watch": "rollup -c rollup.config.js -w" | ||
}, | ||
@@ -23,3 +24,3 @@ "repository": { | ||
"@types/events": "^1.2.0", | ||
"rollup": "^0.64.1", | ||
"rollup": "^0.66.2", | ||
"rollup-plugin-commonjs": "^9.1.5", | ||
@@ -29,4 +30,4 @@ "rollup-plugin-node-builtins": "^2.1.2", | ||
"rollup-plugin-sourcemaps": "^0.4.2", | ||
"rollup-plugin-typescript2": "^0.16.1", | ||
"rollup-plugin-uglify": "^4.0.0", | ||
"rollup-plugin-typescript2": "^0.17.0", | ||
"rollup-plugin-uglify": "^6.0.0", | ||
"tslint": "^5.11.0", | ||
@@ -33,0 +34,0 @@ "typescript": "^3.0.1" |
# WebMap | ||
Universal map constructor |
@@ -0,0 +0,0 @@ import {EventEmitter} from 'events'; |
@@ -0,0 +0,0 @@ import {KeyCodes} from './KeysCodes'; |
@@ -0,0 +0,0 @@ export class KeyCodes { |
@@ -117,3 +117,3 @@ import { AppOptions, MapOptions } from '../interfaces/WebMapApp'; | ||
if (extent_bottom && extent_left && extent_top && extent_right) { | ||
this._extent = [extent_bottom, extent_left, extent_top, extent_right]; | ||
this._extent = [extent_left, extent_bottom, extent_right, extent_top]; | ||
const extent = this._extent; | ||
@@ -136,3 +136,2 @@ if (extent[3] > 82) { | ||
this._zoomToInitialExtent(); | ||
this.emitter.emit('build-map', this.map); | ||
@@ -139,0 +138,0 @@ |
@@ -0,0 +0,0 @@ export interface TreeItem { |
@@ -15,2 +15,4 @@ interface AdapterOptions { | ||
paint?; | ||
type?: 'fill' | 'line' | 'circle' | 'point'; | ||
'source-layer'?: string; | ||
} | ||
@@ -17,0 +19,0 @@ |
@@ -0,0 +0,0 @@ import { LayerAdapter, LayerAdapters } from './LayerAdapter'; |
@@ -0,0 +0,0 @@ import { WebLayerEntry } from '../entities/WebLayerEntry'; |
@@ -0,0 +0,0 @@ const opts = Object.prototype.toString; |
@@ -0,0 +0,0 @@ export function isType(v: any): v is Type<any> { |
@@ -0,0 +0,0 @@ { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1021549
520
2445