xy-map 1.1.41 → 1.1.44

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/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "xy-map",
3
- "version": "1.1.41",
3
+ "version": "1.1.44",
4
4
  "description": "雄越地图",
5
5
  "main": "xy-map.umd.min.js",
6
6
  "scripts": {
7
- "pub": "npm publish"
7
+ "pub": "npm publish --registry=https://registry.npmjs.org/"
8
8
  },
9
9
  "keywords": [],
10
10
  "author": "hanjing",
package/xy-map.common.js CHANGED
@@ -44432,16 +44432,20 @@ class mapSdk {
44432
44432
  * 行政区域边界
44433
44433
  * @param {*} geoJson
44434
44434
  * @param {*} config
44435
+ * @param {*} options 自定义配置
44435
44436
  */
44436
- drawCityBorder(geoJson, config = {}) {
44437
+ drawCityBorder(geoJson, config = {}, options = {}) {
44437
44438
  const style = Object.assign({
44438
44439
  lineWidth: 4,
44439
44440
  lineColor: 'rgb(100,149,237)',
44440
44441
  lineOpacity: 1,
44441
44442
  fillColor: 'rgb(2,26,79)',
44442
- fillOpacity: 0.2
44443
+ fillOpacity: 0.2,
44444
+ lineType: 'solid'
44443
44445
  }, config);
44444
44446
  let mbData = geoJson.features[0].geometry.coordinates[0].flat(1);
44447
+ let paint = options.paint || {};
44448
+ let layout = options.layout || {};
44445
44449
  this.map.addLayer({
44446
44450
  //蒙版边界
44447
44451
  id: 'bj-line',
@@ -44451,14 +44455,15 @@ class mapSdk {
44451
44455
  data: geoJson //区划的面数据
44452
44456
  },
44453
44457
 
44454
- paint: {
44458
+ paint: Object.assign({
44455
44459
  'line-color': style.lineColor || 'rgb(100,149,237)',
44456
44460
  'line-width': style.lineWidth || 3,
44457
- 'line-opacity': style.lineOpacity || 1
44458
- },
44459
- layout: {
44461
+ 'line-opacity': style.lineOpacity || 1,
44462
+ 'line-dasharray': style.lineType == 'dashed' ? [2, 2] : []
44463
+ }, paint),
44464
+ layout: Object.assign({
44460
44465
  visibility: 'visible'
44461
- }
44466
+ }, layout)
44462
44467
  });
44463
44468
  this.map.addLayer({
44464
44469
  //蒙版图层 //通过边界数据反选 达到挖洞效果
@@ -71186,17 +71191,19 @@ const addFlashPoint = (option = {}, layerId) => {
71186
71191
  }); // 2倍屏分辨率
71187
71192
  }
71188
71193
 
71189
- let layout = option.layout || {};
71190
- Object.assign(layout, {
71191
- 'icon-image': imgId
71192
- });
71193
- const opt = Object.assign({}, option, {
71194
- layout
71195
- });
71196
- if (hasLayer(opt.id)) {
71197
- setSource(opt.id, opt.data);
71194
+ //自定义点图层样式
71195
+ option.style = {
71196
+ layout: Object.assign({}, option.layout || {}, {
71197
+ 'icon-image': imgId
71198
+ }),
71199
+ paint: Object.assign({}, option.paint || {}, {
71200
+ 'text-opacity': 0
71201
+ })
71202
+ };
71203
+ if (hasLayer(option.id)) {
71204
+ setSource(option.id, option.data);
71198
71205
  } else {
71199
- addDiyPoint(opt, layerId);
71206
+ addDiyPoint(option, layerId);
71200
71207
  }
71201
71208
  if (option.time > 0) {
71202
71209
  window.clearInterval(clock);
@@ -71504,7 +71511,7 @@ const addLayerPolygon = (option, layerId) => {
71504
71511
  layout: layoutOpt,
71505
71512
  paint: paintOpt,
71506
71513
  ...opt.other
71507
- });
71514
+ }, layerId);
71508
71515
 
71509
71516
  // 面描边
71510
71517
  map.addLayer({
@@ -71545,7 +71552,7 @@ const addLayerPolygon = (option, layerId) => {
71545
71552
 
71546
71553
  // 添加文本图层
71547
71554
  if (opt.text && opt.text.show) {
71548
- addLayerText('point', opt);
71555
+ addLayerText('point', opt, layerId);
71549
71556
  }
71550
71557
  };
71551
71558
  ;// CONCATENATED MODULE: ./src/package/layers/circle.js
package/xy-map.umd.js CHANGED
@@ -44450,16 +44450,20 @@ class mapSdk {
44450
44450
  * 行政区域边界
44451
44451
  * @param {*} geoJson
44452
44452
  * @param {*} config
44453
+ * @param {*} options 自定义配置
44453
44454
  */
44454
- drawCityBorder(geoJson, config = {}) {
44455
+ drawCityBorder(geoJson, config = {}, options = {}) {
44455
44456
  const style = Object.assign({
44456
44457
  lineWidth: 4,
44457
44458
  lineColor: 'rgb(100,149,237)',
44458
44459
  lineOpacity: 1,
44459
44460
  fillColor: 'rgb(2,26,79)',
44460
- fillOpacity: 0.2
44461
+ fillOpacity: 0.2,
44462
+ lineType: 'solid'
44461
44463
  }, config);
44462
44464
  let mbData = geoJson.features[0].geometry.coordinates[0].flat(1);
44465
+ let paint = options.paint || {};
44466
+ let layout = options.layout || {};
44463
44467
  this.map.addLayer({
44464
44468
  //蒙版边界
44465
44469
  id: 'bj-line',
@@ -44469,14 +44473,15 @@ class mapSdk {
44469
44473
  data: geoJson //区划的面数据
44470
44474
  },
44471
44475
 
44472
- paint: {
44476
+ paint: Object.assign({
44473
44477
  'line-color': style.lineColor || 'rgb(100,149,237)',
44474
44478
  'line-width': style.lineWidth || 3,
44475
- 'line-opacity': style.lineOpacity || 1
44476
- },
44477
- layout: {
44479
+ 'line-opacity': style.lineOpacity || 1,
44480
+ 'line-dasharray': style.lineType == 'dashed' ? [2, 2] : []
44481
+ }, paint),
44482
+ layout: Object.assign({
44478
44483
  visibility: 'visible'
44479
- }
44484
+ }, layout)
44480
44485
  });
44481
44486
  this.map.addLayer({
44482
44487
  //蒙版图层 //通过边界数据反选 达到挖洞效果
@@ -71204,17 +71209,19 @@ const addFlashPoint = (option = {}, layerId) => {
71204
71209
  }); // 2倍屏分辨率
71205
71210
  }
71206
71211
 
71207
- let layout = option.layout || {};
71208
- Object.assign(layout, {
71209
- 'icon-image': imgId
71210
- });
71211
- const opt = Object.assign({}, option, {
71212
- layout
71213
- });
71214
- if (hasLayer(opt.id)) {
71215
- setSource(opt.id, opt.data);
71212
+ //自定义点图层样式
71213
+ option.style = {
71214
+ layout: Object.assign({}, option.layout || {}, {
71215
+ 'icon-image': imgId
71216
+ }),
71217
+ paint: Object.assign({}, option.paint || {}, {
71218
+ 'text-opacity': 0
71219
+ })
71220
+ };
71221
+ if (hasLayer(option.id)) {
71222
+ setSource(option.id, option.data);
71216
71223
  } else {
71217
- addDiyPoint(opt, layerId);
71224
+ addDiyPoint(option, layerId);
71218
71225
  }
71219
71226
  if (option.time > 0) {
71220
71227
  window.clearInterval(clock);
@@ -71522,7 +71529,7 @@ const addLayerPolygon = (option, layerId) => {
71522
71529
  layout: layoutOpt,
71523
71530
  paint: paintOpt,
71524
71531
  ...opt.other
71525
- });
71532
+ }, layerId);
71526
71533
 
71527
71534
  // 面描边
71528
71535
  map.addLayer({
@@ -71563,7 +71570,7 @@ const addLayerPolygon = (option, layerId) => {
71563
71570
 
71564
71571
  // 添加文本图层
71565
71572
  if (opt.text && opt.text.show) {
71566
- addLayerText('point', opt);
71573
+ addLayerText('point', opt, layerId);
71567
71574
  }
71568
71575
  };
71569
71576
  ;// CONCATENATED MODULE: ./src/package/layers/circle.js