@antv/l7-layers 2.7.2 → 2.7.3
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.
|
@@ -58,9 +58,9 @@ var DataSourcePlugin = (_dec = injectable(), _dec(_class = function () {
|
|
|
58
58
|
var newZoom = this.mapService.getZoom() - 1;
|
|
59
59
|
var dataSourceNeedUpdate = layer.dataState.dataSourceNeedUpdate;
|
|
60
60
|
|
|
61
|
-
if (cluster && (dataSourceNeedUpdate || Math.abs(layer.clusterZoom - newZoom) >= 1)
|
|
61
|
+
if (cluster && (dataSourceNeedUpdate || Math.abs(layer.clusterZoom - newZoom) >= 1)) {
|
|
62
62
|
if (zoom !== Math.floor(newZoom)) {
|
|
63
|
-
source.updateClusterData(Math.
|
|
63
|
+
source.updateClusterData(Math.floor(newZoom));
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
layer.clusterZoom = newZoom;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/plugins/DataSourcePlugin.ts"],"names":["TYPES","Source","DEFAULT_DATA","DEFAULT_PARSER","injectable","DataSourcePlugin","layer","mapService","getContainer","get","IMapService","hooks","init","tap","source","getSource","sourceOption","data","options","setSource","updateClusterData","beforeRenderData","neeUpdateCluster","dataSourceNeedUpdate","dataState","cluster","clusterOptions","zoom","maxZoom","newZoom","getZoom","Math","abs","clusterZoom","floor"
|
|
1
|
+
{"version":3,"sources":["../../src/plugins/DataSourcePlugin.ts"],"names":["TYPES","Source","DEFAULT_DATA","DEFAULT_PARSER","injectable","DataSourcePlugin","layer","mapService","getContainer","get","IMapService","hooks","init","tap","source","getSource","sourceOption","data","options","setSource","updateClusterData","beforeRenderData","neeUpdateCluster","dataSourceNeedUpdate","dataState","cluster","clusterOptions","zoom","maxZoom","newZoom","getZoom","Math","abs","clusterZoom","floor"],"mappings":";;;;;;AAAA,SAKEA,KALF,QAMO,eANP;AAOA,OAAOC,MAAP,IAAiBC,YAAjB,E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vB;AACA,kCAAmCX,MAAM,CAACY,cAA1C;AAAA,yDAAQC,IAAR;AAAA,UAAQA,IAAR,uCAAe,CAAf;AAAA,yDAAkBC,OAAlB;AAAA,UAAkBA,OAAlB,uCAA4B,EAA5B;AACA,UAAMC,OAAO,GAAG,KAAKtB,UAAL,CAAgBuB,OAAhB,KAA4B,CAA5C;AACA,UAAMP,oBAAoB,GAAGjB,KAAK,CAACkB,SAAN,CAAgBD,oBAA7C;;AAEA,UACEE,OAAO,KACNF,oBAAoB,IAAIQ,IAAI,CAACC,GAAL,CAAS1B,KAAK,CAAC2B,WAAN,GAAoBJ,OAA7B,KAAyC,CAD3D,CADT,EAGE;AAEA,YAAIF,IAAI,KAAKI,IAAI,CAACG,KAAL,CAAWL,OAAX,CAAb,EAAkC;AAChCf,UAAAA,MAAM,CAACM,iBAAP,CAAyBW,IAAI,CAACG,KAAL,CAAWL,OAAX,CAAzB;AACD;;AACDvB,QAAAA,KAAK,CAAC2B,WAAN,GAAoBJ,OAApB;AACA,eAAO,IAAP;AACD;;AACD,aAAO,KAAP;AACD;;;;;SA9CkBxB,gB","sourcesContent":["import {\n ILayer,\n ILayerPlugin,\n ILngLat,\n IMapService,\n TYPES,\n} from '@antv/l7-core';\nimport Source, { DEFAULT_DATA, DEFAULT_PARSER } from '@antv/l7-source';\nimport { injectable } from 'inversify';\nimport 'reflect-metadata';\n\n@injectable()\nexport default class DataSourcePlugin implements ILayerPlugin {\n protected mapService: IMapService;\n public apply(layer: ILayer) {\n this.mapService = layer.getContainer().get<IMapService>(TYPES.IMapService);\n layer.hooks.init.tap('DataSourcePlugin', () => {\n const source = layer.getSource();\n if (!source) {\n // TODO: 允许用户不使用 layer 的 source 方法,在这里传入一个默认的替换的默认数据\n const { data, options } = layer.sourceOption || {\n data: DEFAULT_DATA,\n options: DEFAULT_PARSER,\n };\n layer.setSource(new Source(data, options));\n }\n\n this.updateClusterData(layer);\n });\n\n // 检测数据是否需要更新\n layer.hooks.beforeRenderData.tap('DataSourcePlugin', () => {\n const neeUpdateCluster = this.updateClusterData(layer);\n const dataSourceNeedUpdate = layer.dataState.dataSourceNeedUpdate;\n layer.dataState.dataSourceNeedUpdate = false;\n return neeUpdateCluster || dataSourceNeedUpdate;\n });\n }\n\n private updateClusterData(layer: ILayer): boolean {\n const source = layer.getSource();\n const cluster = source.cluster;\n const { zoom = 0, maxZoom = 16 } = source.clusterOptions;\n const newZoom = this.mapService.getZoom() - 1;\n const dataSourceNeedUpdate = layer.dataState.dataSourceNeedUpdate;\n // 如果 dataSource 有更新,跳过 zoom 的判断,直接更新一次\n if (\n cluster &&\n (dataSourceNeedUpdate || Math.abs(layer.clusterZoom - newZoom) >= 1)\n ) {\n // TODO 判断数据是否更新\n if (zoom !== Math.floor(newZoom)) {\n source.updateClusterData(Math.floor(newZoom));\n }\n layer.clusterZoom = newZoom;\n return true;\n }\n return false;\n }\n}\n"],"file":"DataSourcePlugin.js"}
|
|
@@ -78,9 +78,9 @@ var DataSourcePlugin = (_dec = (0, _inversify.injectable)(), _dec(_class = funct
|
|
|
78
78
|
var newZoom = this.mapService.getZoom() - 1;
|
|
79
79
|
var dataSourceNeedUpdate = layer.dataState.dataSourceNeedUpdate;
|
|
80
80
|
|
|
81
|
-
if (cluster && (dataSourceNeedUpdate || Math.abs(layer.clusterZoom - newZoom) >= 1)
|
|
81
|
+
if (cluster && (dataSourceNeedUpdate || Math.abs(layer.clusterZoom - newZoom) >= 1)) {
|
|
82
82
|
if (zoom !== Math.floor(newZoom)) {
|
|
83
|
-
source.updateClusterData(Math.
|
|
83
|
+
source.updateClusterData(Math.floor(newZoom));
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
layer.clusterZoom = newZoom;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/plugins/DataSourcePlugin.ts"],"names":["DataSourcePlugin","layer","mapService","getContainer","get","TYPES","IMapService","hooks","init","tap","source","getSource","sourceOption","data","DEFAULT_DATA","options","DEFAULT_PARSER","setSource","Source","updateClusterData","beforeRenderData","neeUpdateCluster","dataSourceNeedUpdate","dataState","cluster","clusterOptions","zoom","maxZoom","newZoom","getZoom","Math","abs","clusterZoom","floor"
|
|
1
|
+
{"version":3,"sources":["../../src/plugins/DataSourcePlugin.ts"],"names":["DataSourcePlugin","layer","mapService","getContainer","get","TYPES","IMapService","hooks","init","tap","source","getSource","sourceOption","data","DEFAULT_DATA","options","DEFAULT_PARSER","setSource","Source","updateClusterData","beforeRenderData","neeUpdateCluster","dataSourceNeedUpdate","dataState","cluster","clusterOptions","zoom","maxZoom","newZoom","getZoom","Math","abs","clusterZoom","floor"],"mappings":";;;;;;;;;;;;;;;;;AAAA;;AAOA;;AACA;;AACA;;;;;;;;IAGqBA,gB,WADpB,4B;;;;;;;;WAGC,eAAaC,KAAb,EAA4B;AAAA;;AAC1B,WAAKC,UAAL,GAAkBD,KAAK,CAACE,YAAN,GAAqBC,GAArB,CAAsCC,cAAMC,WAA5C,CAAlB;AACAL,MAAAA,KAAK,CAACM,KAAN,CAAYC,IAAZ,CAAiBC,GAAjB,CAAqB,kBAArB,EAAyC,YAAM;AAC7C,YAAMC,MAAM,GAAGT,KAAK,CAACU,SAAN,EAAf;;AACA,YAAI,CAACD,MAAL,EAAa;AAEX,qBAA0BT,KAAK,CAACW,YAAN,IAAsB;AAC9CC,YAAAA,IAAI,EAAEC,sBADwC;AAE9CC,YAAAA,OAAO,EAAEC;AAFqC,WAAhD;AAAA,cAAQH,IAAR,QAAQA,IAAR;AAAA,cAAcE,OAAd,QAAcA,OAAd;;AAIAd,UAAAA,KAAK,CAACgB,SAAN,CAAgB,IAAIC,iBAAJ,CAAWL,IAAX,EAAiBE,OAAjB,CAAhB;AACD;;AAED,QAAA,KAAI,CAACI,iBAAL,CAAuBlB,KAAvB;AACD,OAZD;AAeAA,MAAAA,KAAK,CAACM,KAAN,CAAYa,gBAAZ,CAA6BX,GAA7B,CAAiC,kBAAjC,EAAqD,YAAM;AACzD,YAAMY,gBAAgB,GAAG,KAAI,CAACF,iBAAL,CAAuBlB,KAAvB,CAAzB;;AACA,YAAMqB,oBAAoB,GAAGrB,KAAK,CAACsB,SAAN,CAAgBD,oBAA7C;AACArB,QAAAA,KAAK,CAACsB,SAAN,CAAgBD,oBAAhB,GAAuC,KAAvC;AACA,eAAOD,gBAAgB,IAAIC,oBAA3B;AACD,OALD;AAMD;;;WAED,2BAA0BrB,KAA1B,EAAkD;AAChD,UAAMS,MAAM,GAAGT,KAAK,CAACU,SAAN,EAAf;AACA,UAAMa,OAAO,GAAGd,MAAM,CAACc,OAAvB;AACA,kCAAmCd,MAAM,CAACe,cAA1C;AAAA,yDAAQC,IAAR;AAAA,UAAQA,IAAR,uCAAe,CAAf;AAAA,yDAAkBC,OAAlB;AAAA,UAAkBA,OAAlB,uCAA4B,EAA5B;AACA,UAAMC,OAAO,GAAG,KAAK1B,UAAL,CAAgB2B,OAAhB,KAA4B,CAA5C;AACA,UAAMP,oBAAoB,GAAGrB,KAAK,CAACsB,SAAN,CAAgBD,oBAA7C;;AAEA,UACEE,OAAO,KACNF,oBAAoB,IAAIQ,IAAI,CAACC,GAAL,CAAS9B,KAAK,CAAC+B,WAAN,GAAoBJ,OAA7B,KAAyC,CAD3D,CADT,EAGE;AAEA,YAAIF,IAAI,KAAKI,IAAI,CAACG,KAAL,CAAWL,OAAX,CAAb,EAAkC;AAChClB,UAAAA,MAAM,CAACS,iBAAP,CAAyBW,IAAI,CAACG,KAAL,CAAWL,OAAX,CAAzB;AACD;;AACD3B,QAAAA,KAAK,CAAC+B,WAAN,GAAoBJ,OAApB;AACA,eAAO,IAAP;AACD;;AACD,aAAO,KAAP;AACD","sourcesContent":["import {\n ILayer,\n ILayerPlugin,\n ILngLat,\n IMapService,\n TYPES,\n} from '@antv/l7-core';\nimport Source, { DEFAULT_DATA, DEFAULT_PARSER } from '@antv/l7-source';\nimport { injectable } from 'inversify';\nimport 'reflect-metadata';\n\n@injectable()\nexport default class DataSourcePlugin implements ILayerPlugin {\n protected mapService: IMapService;\n public apply(layer: ILayer) {\n this.mapService = layer.getContainer().get<IMapService>(TYPES.IMapService);\n layer.hooks.init.tap('DataSourcePlugin', () => {\n const source = layer.getSource();\n if (!source) {\n // TODO: 允许用户不使用 layer 的 source 方法,在这里传入一个默认的替换的默认数据\n const { data, options } = layer.sourceOption || {\n data: DEFAULT_DATA,\n options: DEFAULT_PARSER,\n };\n layer.setSource(new Source(data, options));\n }\n\n this.updateClusterData(layer);\n });\n\n // 检测数据是否需要更新\n layer.hooks.beforeRenderData.tap('DataSourcePlugin', () => {\n const neeUpdateCluster = this.updateClusterData(layer);\n const dataSourceNeedUpdate = layer.dataState.dataSourceNeedUpdate;\n layer.dataState.dataSourceNeedUpdate = false;\n return neeUpdateCluster || dataSourceNeedUpdate;\n });\n }\n\n private updateClusterData(layer: ILayer): boolean {\n const source = layer.getSource();\n const cluster = source.cluster;\n const { zoom = 0, maxZoom = 16 } = source.clusterOptions;\n const newZoom = this.mapService.getZoom() - 1;\n const dataSourceNeedUpdate = layer.dataState.dataSourceNeedUpdate;\n // 如果 dataSource 有更新,跳过 zoom 的判断,直接更新一次\n if (\n cluster &&\n (dataSourceNeedUpdate || Math.abs(layer.clusterZoom - newZoom) >= 1)\n ) {\n // TODO 判断数据是否更新\n if (zoom !== Math.floor(newZoom)) {\n source.updateClusterData(Math.floor(newZoom));\n }\n layer.clusterZoom = newZoom;\n return true;\n }\n return false;\n }\n}\n"],"file":"DataSourcePlugin.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/l7-layers",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.3",
|
|
4
4
|
"description": "L7's collection of built-in layers",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"license": "ISC",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@antv/geo-coord": "^1.0.8",
|
|
27
|
-
"@antv/l7-core": "^2.7.
|
|
28
|
-
"@antv/l7-source": "^2.7.
|
|
29
|
-
"@antv/l7-utils": "^2.7.
|
|
27
|
+
"@antv/l7-core": "^2.7.3",
|
|
28
|
+
"@antv/l7-source": "^2.7.3",
|
|
29
|
+
"@antv/l7-utils": "^2.7.3",
|
|
30
30
|
"@babel/runtime": "^7.7.7",
|
|
31
31
|
"@mapbox/martini": "^0.2.0",
|
|
32
32
|
"@turf/meta": "^6.0.2",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@types/gl-matrix": "^2.4.5",
|
|
53
53
|
"@types/lodash": "^4.14.138"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "77c5c8f5ea9556023d08937d5a419831d7d0d4bd",
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|
|
58
58
|
}
|