| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent eb8c806 commit 257cc45
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -213,6 +213,9 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo }) { | |||
| 213 | 213 | } | |
| 214 | 214 | this.expectLayerLen += overLayers.length; | |
| 215 | 215 | } | |
| 216 | + if (mapInfo.grid && mapInfo.grid.graticule) { | ||
| 217 | + this.expectLayerLen++; | ||
| 218 | + } | ||
| 216 | 219 | } | |
| 217 | 220 | ||
| 218 | 221 | _shouldLoadBaseLayer(mapInfo, layerFilter) { | |
@@ -506,6 +509,7 @@ export function createWebMapV2Extending(SuperClass, { MapManager, mapRepo }) { | |||
| 506 | 509 | parentLayerId: graticuleLayer.id, | |
| 507 | 510 | subRenderLayers: [{ layerId: graticuleLayer.id }, { layerId: graticuleLayer.sourceId }] | |
| 508 | 511 | }); | |
| 512 | + this._addLayerSucceeded(); | ||
| 509 | 513 | } | |
| 510 | 514 | ||
| 511 | 515 | _createGraticuleOptions(graticuleInfo) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -95,6 +95,9 @@ export function createMapExtendExtending(product) { | |||
| 95 | 95 | if (overlayLayer.setLayoutProperty) { | |
| 96 | 96 | overlayLayer.setLayoutProperty(name, value); | |
| 97 | 97 | this.style.fire('data', { dataType: 'style' }); | |
| 98 | + } else if (name === 'visibility' && overlayLayer.setVisibility) { | ||
| 99 | + overlayLayer.setVisibility(value === 'visible'); | ||
| 100 | + this.style.fire('data', { dataType: 'style' }); | ||
| 98 | 101 | } | |
| 99 | 102 | return this; | |
| 100 | 103 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -507,6 +507,7 @@ describe('mapboxgl_WebMapV2', () => { | |||
| 507 | 507 | }; | |
| 508 | 508 | datavizWebmap.map.fire('zoomend'); | |
| 509 | 509 | expect(data).not.toBeUndefined(); | |
| 510 | + expect(data.layers.slice(-1)[0].id).toContain('graticuleLayer_'); | ||
| 510 | 511 | done(); | |
| 511 | 512 | }; | |
| 512 | 513 | datavizWebmap = new WebMap(id, { ...commonOption }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -82,6 +82,20 @@ describe('mapboxgl_GraticuleLayer', () => { | |||
| 82 | 82 | expect(visible).toBe('visible'); | |
| 83 | 83 | }); | |
| 84 | 84 | ||
| 85 | + it('setLayoutProperty', () => { | ||
| 86 | + let visible = map.getLayoutProperty('graticuleLayer_1_line', 'visibility'); | ||
| 87 | + expect(visible).toBe('visible'); | ||
| 88 | + expect(graticuleLayer.visible).toBeTruthy(); | ||
| 89 | + map.setLayoutProperty(graticuleLayer.id, 'visibility', 'none'); | ||
| 90 | + visible = map.getLayoutProperty('graticuleLayer_1_line', 'visibility'); | ||
| 91 | + expect(visible).toBe('none'); | ||
| 92 | + expect(graticuleLayer.visible).toBeFalsy(); | ||
| 93 | + map.setLayoutProperty(graticuleLayer.id, 'visibility', 'visible'); | ||
| 94 | + visible = map.getLayoutProperty('graticuleLayer_1_line', 'visibility'); | ||
| 95 | + expect(visible).toBe('visible'); | ||
| 96 | + expect(graticuleLayer.visible).toBeTruthy(); | ||
| 97 | + }); | ||
| 98 | + | ||
| 85 | 99 | it('setMinZoom', () => { | |
| 86 | 100 | graticuleLayer.setMinZoom(0); | |
| 87 | 101 | expect(graticuleLayer.options.minZoom).toEqual(0); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -508,6 +508,7 @@ describe('maplibregl_WebMapV2', () => { | |||
| 508 | 508 | }; | |
| 509 | 509 | datavizWebmap.map.fire('zoomend'); | |
| 510 | 510 | expect(data).not.toBeUndefined(); | |
| 511 | + expect(data.layers.slice(-1)[0].id).toContain('graticuleLayer_'); | ||
| 511 | 512 | done(); | |
| 512 | 513 | }; | |
| 513 | 514 | datavizWebmap = new WebMap(id, { ...commonOption }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -84,6 +84,20 @@ describe('maplibregl_GraticuleLayer', () => { | |||
| 84 | 84 | expect(visible).toBe('visible'); | |
| 85 | 85 | }); | |
| 86 | 86 | ||
| 87 | + it('setLayoutProperty', () => { | ||
| 88 | + let visible = map.getLayoutProperty('graticuleLayer_1_line', 'visibility'); | ||
| 89 | + expect(visible).toBe('visible'); | ||
| 90 | + expect(graticuleLayer.visible).toBeTruthy(); | ||
| 91 | + map.setLayoutProperty(graticuleLayer.id, 'visibility', 'none'); | ||
| 92 | + visible = map.getLayoutProperty('graticuleLayer_1_line', 'visibility'); | ||
| 93 | + expect(visible).toBe('none'); | ||
| 94 | + expect(graticuleLayer.visible).toBeFalsy(); | ||
| 95 | + map.setLayoutProperty(graticuleLayer.id, 'visibility', 'visible'); | ||
| 96 | + visible = map.getLayoutProperty('graticuleLayer_1_line', 'visibility'); | ||
| 97 | + expect(visible).toBe('visible'); | ||
| 98 | + expect(graticuleLayer.visible).toBeTruthy(); | ||
| 99 | + }); | ||
| 100 | + | ||
| 87 | 101 | it('getDefaultExtent must return degree', () => { | |
| 88 | 102 | map.getCRS = () => { | |
| 89 | 103 | return { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments